This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getData = limit => { | |
const data = []; | |
let index = 0; | |
while(index < limit){ | |
data.push(`Item ${index}`); | |
index++; | |
} | |
return data; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function handler(index) { | |
alert(index) | |
} | |
function hookupevents() { | |
for (var i = 0; i < 3; i++) { | |
document.getElementById("button" + i).addEventListener("click", handler.bind(this,i)); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function hookupevents(){ | |
for(var i = 0; i < 3; i++){functon(index){ | |
document.getElementsById("button" + index).addEventListener('click', function() {alert (index)}) | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isMultiple(number, baseNumber) { return !(number % baseNumber); } | |
for (var i = 1; i < 101; i++) { | |
if (isMultiple(i,3)){ | |
if (isMultiple(i,5)) { | |
console.log("FizzBuzz") | |
} else { | |
console.log("Fizz") | |
} | |
}else if(isMultiple(i,5)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as express from 'express'; | |
import {Application} from "express"; | |
const webpush = require('web-push'); | |
const bodyParser = require('body-parser'); | |
const cors = require('cors'); | |
const vapidKeys = { | |
"publicKey":..., | |
"privateKey":... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- delete a customer | |
-- bcos of constraint | |
-- first turn off foreign_key_checks | |
SET foreign_key_checks = 0; | |
-- dorp customer(s) | |
SET foreign_key_checks = 1; | |
-- INNER JOIN | |
-- fetch details of customers and orders they made | |
-- wont show details of orders of customer 11 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
public class City | |
{ | |
public int x, y; | |
public City(int p1, int p2) | |
{ | |
x = p1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git for-each-ref --sort=committerdate refs/heads/ --format='%(committerdate:short) %(refname:short)' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from '@angular/core'; | |
import { DomSanitizer, SafeHtml } from '@angular/platform-browser'; | |
interface FormatterPatternAndReplacement { | |
pattern: RegExp; | |
replacement: string; | |
} | |
@Injectable() | |
export class Formatter { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"scripts": { | |
"lint": "node node_modules/eslint/bin/eslint.js src --config ./.eslintrc.json", | |
"lint:fix": "npm run lint -- --fix", | |
"pre-package": "npm run lint && mv node_modules full_node_modules && npm prune --production", | |
"package": "npm run pre-package && npm run pack-publish && npm run post-package", | |
"post-package": "rm -rf node_modules && mv full_node_modules node_modules", | |
"pack-publish": "rm code.zip && zip -r code.zip src package.json node_modules", | |
"test": "npm run test" | |
} |
OlderNewer