Snippets Collections
# Python program to check if the number is an Armstrong number or not

# take input from the user
num = int(input("Enter a number: "))

# initialize sum
sum = 0

# find the sum of the cube of each digit
temp = num
while temp > 0:
   digit = temp % 10
   sum += digit ** 3
   temp //= 10

# display the result
if num == sum:
   print(num,"is an Armstrong number")
else:
   print(num,"is not an Armstrong number")
# Python program to check if the number is an Armstrong number or not
<html>
  <head>...</head>
  <body>
    ...
    <div>...</div>
    ..
  </body>
</html>
function Welcome(props) {
  return <h1>Hello, {props.name}</h1>;
}


const element = <Welcome name="Sara" />;
ReactDOM.render(
  element,
  document.getElementById('root')
);
function findOdd(A) {
  //happy coding!
  
  return 0;
}
static public function slugify($text)
{ 
  $text = str_replace(" ", "_", $text);

  // replace non letter or digits by -
  $text = preg_replace('~[^\\pL\d_]+~u', '-', $text);

  // trim
  $text = trim($text, '-');

  // transliterate
  $text = iconv('utf-8', 'us-ascii//TRANSLIT', $text);

  // lowercase
  $text = strtolower($text);

  // remove unwanted characters
  $text = preg_replace('~[^-\w]+~', '', $text);

  if (empty($text))
  {
    return 'n-a';
  }

  return $text;
}
If anyone comes across this in 2020, this issue in the vscode-python repo saved my life. Basically, just do the following:

Uninstall the Python extension
Delete the file that contains the extension from your ~/.vscode folder (mine looked like ms-python.python-[YEAR].[MONTH].[VERSION])
Reinstall the extension
Worked like a charm.
function myFunction(name) {
  return "Hello " + name;
}
document.getElementById("demo").innerHTML = myFunction("John");
check
You're good to go!
Start saving code from anywhere online.
<li *ngFor='let category of categorys'>
  <div>{{ category.category_name }}</div>
  <div *ngFor="let subCategory of category.sub_category_names?.split(',')">
     {{ subCategory }}
  </div>
</li>
public ResponseEntity<JSONObject> getComprehensiveInquiryCp(@Validated @RequestBody ComprehensiveInquiryRequestModel body) {
        Map<String, Object> content;
        JSONObject result = new JSONObject();
        String sLicense = body.getSLicense();
...
}
PUT _cluster/settings
{
  "transient": {
    "cluster.routing.allocation.disk.watermark.low": "100gb",
    "cluster.routing.allocation.disk.watermark.high": "50gb",
    "cluster.routing.allocation.disk.watermark.flood_stage": "10gb",
    "cluster.info.update.interval": "1m"
  }
}
#!/usr/bin/python

import sys
import logging

logging.basicConfig(stream=sys.stderr)
sys.path.insert(0,"/home/sfps/www/shoreapp/")

from app import app as application
// custom menu function
function onOpen() {
  var ui = SpreadsheetApp.getUi();
  ui.createMenu('Custom Menu')
      .addItem('Save Data','saveData')
      .addToUi();
}

// function to save data
function saveData() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = ss.getSheets()[0];
  var url = sheet.getRange('Sheet1!A1').getValue();
  var follower_count = sheet.getRange('Sheet1!B1').getValue();
  var date = sheet.getRange('Sheet1!C1').getValue();
  sheet.appendRow([url,follower_count,date]);
}
ou're good to go!
Start saving code from anywhere onlin
app.use(async ctx => {
  ctx; // is the Context
  ctx.request; // is a Koa Request
  ctx.response; // is a Koa Response
});
char* names[] = {"Jack", "Tom", "John"};
for (int i = 0; i < 3; i++)
   {
    printf("%s\n", names[i]);
   }
$execution_time = microtime(); // Start counting

// Your code

$execution_time = microtime() - $execution_time;
printf('It took %.5f sec', $execution_time);
nav {
  ul {
    margin: 0;
    padding: 0;
    list-style: none;
  }

  li { display: inline-block; }

  a {
    display: block;
    padding: 6px 12px;
    text-decoration: none;
  }
}
    export class Mainapp {

    showBeforeLogin:any = true;
    showAfterLogin:any;
    constructor( public router: Router) {
     this.changeOfRoutes();

     }
     changeOfRoutes(){
      if(this.router.url === '/'){
         this.showAfterLogin = true;
      }
     }
}
    export class Mainapp {

    showBeforeLogin:any = true;
    showAfterLogin:any;
    constructor( public router: Router) {
     this.changeOfRoutes();

     }
     changeOfRoutes(){
      if(this.router.url === '/'){
         this.showAfterLogin = true;
      }
     }
}
var images = document.getElementsByTagName('img');
for (i = 0; i < images.length;i++ ) {
    images[i].style.display = "none";
}
>>> import requests

>>> r = requests.get('https://api.github.com/events')
>>> r.json()
[{'repository': {'open_issues': 0, 'url': 'https://github.com/...
assignment_stmt ::=  (target_list "=")+ (starred_expression | yield_expression)
target_list     ::=  target ("," target)* [","]
target          ::=  identifier
                     | "(" [target_list] ")"
                     | "[" [target_list] "]"
                     | attributeref
                     | subscription
                     | slicing
                     | "*" target
import_stmt     ::=  "import" module ["as" identifier] ("," module ["as" identifier])*
                     | "from" relative_module "import" identifier ["as" identifier]
                     ("," identifier ["as" identifier])*
                     | "from" relative_module "import" "(" identifier ["as" identifier]
                     ("," identifier ["as" identifier])* [","] ")"
                     | "from" module "import" "*"
module          ::=  (identifier ".")* identifier
relative_module ::=  "."* module | "."+
# make sure to define the correct path to your html page when rendering a view

# prev:

def found_or_join_startup(request):
    return render(request, 'templates/categories/found-or-join-startup.html')
   # templates/ interferes with the filepath that is defined in urls.py

# after fix

def found_or_join_startup(request):
    return render(request, 'categories/found-or-join-startup.html')
List-Unsubscribe: 
  <mailto:test@example.com>, 
  <https://example.com/unsubscribe?uid=0000>
Type    Host name               Points to address or value			TTL	          
MX      @                       yourdomain-com.mail.protection.outlook.com	1 Hour
TXT     @			v=spf1 include:spf.protection.outlook.com -all	1 Hour
CNAME   autodiscover            autodiscover.outlook.com                       1 Hour
CNAME   sip			sipdir.online.lync.com				1 Hour
CNAME	lyncdiscover		webdir.online.lync.com				1 Hour
CNAME	enterpriseregistration	enterpriseregistration.windows.net		1 Hour
CNAME	enterpriseenrollment	enterpriseenrollment.manage.microsoft.com	1 Hour
CNAME   selector1._domainkey    selector1-yourdomain-com._domainkey.YOURTENANT.onmicrosoft.com 
CNAME   selector2._domainkey    selector2-yourdomain-com._domainkey.YOURTENANT.onmicrosoft.com

Type	Service			Protocol Port	Weight	 Priority	TTL 	Name	Target	
SRV	_sip			_tls	 443	   1	    100	   1 Hour	@	sipdir.online.lync.com
SRV 	_sipfederationtls	_tcp	 5061	   1	    100	   1 Hour	@	sipfed.online.lync.com
usersRef.child("alanisawesome").setValueAsync(new User("June 23, 1912", "Alan Turing"));
usersRef.child("gracehop").setValueAsync(new User("December 9, 1906", "Grace Hopper"));
  
createAccount(username, contact_email, password) -> account_id
addSubscription(account_id, subscription_type) -> subscription_id
sendActivationReminderEmail(account_id) -> null
cancelSubscription(subscription_id, reason, immediate=True) -> null
getAccountDetails(account_id) -> {full data tree}

cd app/v2 && sequelize-auto -h localhost -d footfinder -p 3306 -u root -x root -t sellersSubscriptions
Python 3
For the directory of the script being run:

import pathlib
pathlib.Path(__file__).parent.absolute()
 Save
For the current working directory:

import pathlib
pathlib.Path().absolute()
.masonry { 
  display: flex;
  flex-flow: row wrap;
  margin-left: -8px; /* Adjustment for the gutter */
  width: 100%;
}

.masonry-brick {
  flex: auto;
  height: 250px;
  min-width: 150px;
  margin: 0 8px 8px 0; /* Some gutter */
}
MAIL_MAILER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=fe4cee575c31c6
MAIL_PASSWORD=2164dadcd884d3
MAIL_ENCRYPTION=tls
@mixin heading-font {
  font-family: sans-serif;
  font-weight: bold;
}
def Sort(sub_li): 
  
    # reverse = None (Sorts in Ascending order) 
    # key is set to sort using second element of  
    # sublist lambda has been used 
    sub_li.sort(key = lambda x: x[1]) 
    return sub_li
def Sort(sub_li): 
  
    # reverse = None (Sorts in Ascending order) 
    # key is set to sort using second element of  
    # sublist lambda has been used 
    return(sorted(sub_li, key = lambda x: x[1]))
function sleep(milliseconds) {
  var start = new Date().getTime();
  for (var i = 0; i < 1e7; i++) {
    if ((new Date().getTime() - start) > milliseconds){
      break;
    }
  }
}
star

Sat May 23 2020 09:24:17 GMT+0000 (Coordinated Universal Time) https://www.programiz.com/python-programming/examples/armstrong-number

@abdullahrkw

star

Sat May 23 2020 09:46:08 GMT+0000 (Coordinated Universal Time) https://www.programiz.com/python-programming/examples/armstrong-number

@abdullahrkw

star

Sat May 23 2020 21:23:21 GMT+0000 (Coordinated Universal Time) http://jasonette.com/

@bmweinstein

star

Sat May 23 2020 21:38:48 GMT+0000 (Coordinated Universal Time) https://reactjs.org/docs/components-and-props.html

@bmweinstein

star

Sun May 24 2020 16:08:11 GMT+0000 (Coordinated Universal Time) https://www.codewars.com/kata/54da5a58ea159efa38000836/train/javascript/5ec5f295d7cf62002dd2cae7

@prasen

star

Tue May 26 2020 07:40:01 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/3829776/php-clean-function-not-working-correctly

@oropocket

star

Tue May 26 2020 09:06:41 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/54387442/vs-code-not-finding-pytest-tests

@amypeniston

star

Tue May 26 2020 11:48:24 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/1263680/maximum-execution-time-in-phpmyadmin

@Ali Raza

star

Tue May 26 2020 12:19:38 GMT+0000 (Coordinated Universal Time) https://www.thiscodeworks.com/extension/initializing

@douglasevaristo

star

Tue May 26 2020 12:48:27 GMT+0000 (Coordinated Universal Time) https://novotmn.ru/podbor-planirovok/?area_from=

@Alex72

star

Tue May 26 2020 13:04:57 GMT+0000 (Coordinated Universal Time) https://www.w3schools.com/jsref/jsref_return.asp

@Sai Rakshith

star

Tue May 26 2020 16:45:03 GMT+0000 (Coordinated Universal Time) https://www.thiscodeworks.com/extension/initializing

@cboutens

star

Tue May 26 2020 18:26:40 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/52662419/displaying-comma-separated-string-in-angular-6

@usama butt

star

Tue May 26 2020 20:28:20 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/62024987/springmvc-can-not-bind-json-correctly

@afyonur

star

Tue May 26 2020 22:43:46 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/29974455/why-might-pythons-from-form-of-an-import-statement-bind-a-module-name

@everett

star

Tue May 26 2020 22:54:48 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/50609417/elasticsearch-error-cluster-block-exception-forbidden-12-index-read-only-all

@jacqui

star

Tue May 26 2020 23:16:28 GMT+0000 (Coordinated Universal Time) https://www.thiscodeworks.com/extension/initializing

@nicholas

star

Tue May 26 2020 23:30:41 GMT+0000 (Coordinated Universal Time) https://www.digitalocean.com/community/questions/why-does-my-flask-app-on-apache2-wsgi-not-load-waiting-for-host

@everett

star

Wed May 27 2020 07:19:23 GMT+0000 (Coordinated Universal Time) https://www1.zonewebmaster.eu/serveur-debian-general:regler-date-heure

@KilianRocuet

star

Wed May 27 2020 07:19:39 GMT+0000 (Coordinated Universal Time) https://www.windows8facile.fr/linux-cmd-date-heure/

@KilianRocuet

star

Wed May 27 2020 11:38:35 GMT+0000 (Coordinated Universal Time) https://www.thiscodeworks.com/

@celoubao

star

Wed May 27 2020 11:39:00 GMT+0000 (Coordinated Universal Time) https://www.thiscodeworks.com/extension/login

@celoubao

star

Wed May 27 2020 13:25:10 GMT+0000 (Coordinated Universal Time) https://www.benlcollins.com/apps-script/google-apps-script-beginner-guide/

@shadroid

star

Wed May 27 2020 18:32:35 GMT+0000 (Coordinated Universal Time) https://www.facebook.com/

@Hamza

star

Wed May 27 2020 18:57:39 GMT+0000 (Coordinated Universal Time) https://www.thiscodeworks.com/extension/initializing

@bitelse

star

Wed May 27 2020 20:25:36 GMT+0000 (Coordinated Universal Time) https://koajs.com/

@gstucki

star

Wed May 27 2020 20:37:49 GMT+0000 (Coordinated Universal Time) https://www.codeproject.com/Questions/1222366/C-programming-how-do-I-store-names-in-one-dimensio

@lkmandy

star

Thu May 28 2020 10:27:17 GMT+0000 (Coordinated Universal Time) https://support.system76.com/articles/install-pop/

@jojede9558

star

Fri May 29 2020 10:11:04 GMT+0000 (Coordinated Universal Time) https://css-tricks.com/snippets/php/count-script-excecution-time/

@Amna

star

Fri May 29 2020 16:42:49 GMT+0000 (Coordinated Universal Time) https://sass-lang.com/guide

@samiharoon

star

Fri May 29 2020 16:43:52 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/42453375/how-to-call-a-function-on-every-route-change-in-angular2

@mohsin

star

Fri May 29 2020 16:44:27 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/42453375/how-to-call-a-function-on-every-route-change-in-angular2

@mohsin

star

Sat May 30 2020 13:57:20 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/5780921/how-to-hide-all-images-using-javascript

@ayazahmadtarar

star

Sat May 30 2020 18:17:47 GMT+0000 (Coordinated Universal Time) https://2.python-requests.org/en/master/user/quickstart/

@bmweinstein

star

Sat May 30 2020 18:19:42 GMT+0000 (Coordinated Universal Time) https://docs.python.org/3/reference/simple_stmts.html

@bmweinstein

star

Sat May 30 2020 18:23:09 GMT+0000 (Coordinated Universal Time) https://docs.python.org/3/reference/simple_stmts.html

@bmweinstein

star

Sat May 30 2020 19:13:31 GMT+0000 (Coordinated Universal Time) https://blog.leavemealone.app/how-does-the-gmail-unsubscribe-button-work/

@bmweinstein

star

Mon Jun 01 2020 09:48:10 GMT+0000 (Coordinated Universal Time) https://community.cloudflare.com/t/need-help-with-office-365-error/80501/2

@kevin

star

Tue Jun 02 2020 03:49:38 GMT+0000 (Coordinated Universal Time) https://firebase.google.com/docs/database/admin/save-data

@bmweinstein

star

Tue Jun 02 2020 04:54:43 GMT+0000 (Coordinated Universal Time) https://cloud.google.com/blog/products/api-management/understanding-grpc-openapi-and-rest-and-when-to-use-them

@bmweinstein

star

Wed Jun 03 2020 08:41:54 GMT+0000 (Coordinated Universal Time)

@darshandixit

star

Thu Jun 04 2020 19:39:27 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/3430372/how-do-i-get-the-full-path-of-the-current-files-directory

@hoangthienan95

star

Sat Jun 06 2020 16:38:07 GMT+0000 (Coordinated Universal Time) chrome-extension://annlhfjgbkfmbbejkbdpgbmpbcjnehbb/images/saveicon.png

@hamzaafridi

star

Sat Jun 06 2020 16:52:31 GMT+0000 (Coordinated Universal Time) chrome-extension://annlhfjgbkfmbbejkbdpgbmpbcjnehbb/images/saveicon.png

@shahzaibkhan

star

Sat Jun 06 2020 23:46:35 GMT+0000 (Coordinated Universal Time)

@evanlen

star

Sun Jun 07 2020 10:19:11 GMT+0000 (Coordinated Universal Time) chrome-extension://annlhfjgbkfmbbejkbdpgbmpbcjnehbb/images/saveicon.png

@dawood

star

Sun Jun 07 2020 18:19:33 GMT+0000 (Coordinated Universal Time) https://www.geeksforgeeks.org/python-sort-list-according-second-element-sublist/

@Caliber X

star

Sun Jun 07 2020 18:20:41 GMT+0000 (Coordinated Universal Time) https://www.geeksforgeeks.org/python-sort-list-according-second-element-sublist/

@Caliber X

star

Mon Jun 08 2020 06:58:11 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/17883692/how-to-set-time-delay-in-javascript/49813472

@Hamza

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension