Skip to content

Instantly share code, notes, and snippets.

View easierbycode's full-sized avatar

▓▒░ ♔ Daniel ♔ ░▒▓ easierbycode

View GitHub Profile
@easierbycode
easierbycode / object.is.js
Created April 29, 2016 20:30
can be used to replace '==='. fixes some ES5 issues.
let notNum = NaN;
console.log( notNum === notNum );
// false
console.log( Object.is(notNum, notNum) )
// true
let amt = 0, total = -0;
console.log( amt === total )
let title = 'Santa Claus';
console.log( title.startsWith( 'Santa' ) );
// true
console.log( title.endsWith( 'Claus' ) );
// true
console.log( title.includes('clau') );
// false
@easierbycode
easierbycode / string.repeat.js
Created April 29, 2016 20:45
shows using string repeat w/ an astral plane character (a wave emoji)
let wave = '\u{1f30a}';
console.log( wave.repeat(10) );
// 🌊🌊🌊🌊🌊🌊🌊🌊🌊🌊
@easierbycode
easierbycode / math.trunc.js
Created April 29, 2016 20:54
truncates the decimal part of a number
let num = 29.9;
console.log( Math.trunc( num ) );
@easierbycode
easierbycode / config.js
Created July 7, 2016 20:21
HTTP polling in Angular 2
System.config({
//use typescript for compilation
transpiler: 'typescript',
//typescript compiler options
typescriptOptions: {
emitDecoratorMetadata: true
},
//map tells the System loader where to look for things
map: {
app: './src'
{
"status": 0,
"body": {
"updatetime": 1249409679,
"timezone": "Europe/Paris",
"measuregrps": [
{
"grpid": 2909,
"attrib": 0,
"date": 1222930968,
<link type='text/css' rel='stylesheet' href='https://npmcdn.com/[email protected]/bundles/ionic.css'>
<script src='./show-frame-section.js'></script>
<iframe name='terms-frame' onload="showFrameSection( 'section' )" src='./terms.html' height='100%' width='100%' frameborder='0'></iframe>
{
"etcd": {
"enabled": true
},
"nginx": {
"enabled": true
},
"mongodb": {
"enabled": true
},
.parallax-inner .fusion-column-wrapper {
background-color: rgba(255,255,255,0.1);
text-shadow: 1px 1px 1px #666;
}
{
"deviceType": "urn:Belkin:device:controllee:1",
"friendlyName": "Desk light",
"manufacturer": "Belkin International Inc.",
"manufacturerURL": "http://www.belkin.com",
"modelDescription": "Belkin Plugin Socket 1.0",
"modelName": "Socket",
"modelNumber": "1.0",
"modelURL": "http://www.belkin.com/plugin/",
"serialNumber": "221651K0100262",