// function scope for moduling
!function() {
var style = document.createElement('style');
style.innerText = '::-webkit-scrollbar { width: 8px; }';
document.getElementsByTagName('head')[0].appendChild(style);
This file contains hidden or 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
var arr = [ 1, 2, 3, 4 ]; | |
var newArr = arr.map(x => x * 10); | |
console.log('arr => ', arr); | |
console.log('newArr => ', newArr); |
This file contains hidden or 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
// Demo: http://jsfiddle.net/pFaSx/ | |
// Create an invisible iframe | |
var iframe = document.createElement('iframe'); | |
iframe.id = "hacky-scrollbar-resize-listener"; | |
iframe.style.cssText = 'height: 0; background-color: transparent; margin: 0; padding: 0; overflow: hidden; border-width: 0; position: absolute; width: 100%;'; | |
// Register our event when the iframe loads | |
iframe.onload = function() { | |
// The trick here is that because this iframe has 100% width |
This file contains hidden or 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
//Below is a JavaScript snippet that parses the response and returns the parameters to the server. | |
// First, parse the query string | |
var params = {}, queryString = location.hash.substring(1), | |
regex = /([^&=]+)=([^&]*)/g, m; | |
while (m = regex.exec(queryString)) { | |
params[decodeURIComponent(m[1])] = decodeURIComponent(m[2]); | |
} | |
// And send the token over to the server |
This file contains hidden or 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 { Component } from '@angular/core'; | |
@Component({ | |
selector: 'sth', | |
template: `<h2> Hello {{ title }} </h2>` | |
}) | |
export class TemplateTestComponent { | |
title: string = " Something "; | |
} |
This file contains hidden or 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'; | |
@Injectable() | |
export class ValueConfig { | |
title: string; | |
getTitle(): string { | |
return this.title; | |
} | |
} |
This file contains hidden or 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, Component } from '@angular/core'; | |
@Injectable() | |
export class AService { | |
// ... | |
} | |
@Component({ | |
// ... | |
providers: [ AService ] |
This file contains hidden or 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
package com.features; | |
import com.facebook.react.bridge.NativeModule; | |
import com.facebook.react.bridge.ReactApplicationContext; | |
import com.facebook.react.bridge.ReactContext; | |
import com.facebook.react.bridge.ReactContextBaseJavaModule; | |
import com.facebook.react.bridge.ReactMethod; | |
import android.util.Log; |
This file contains hidden or 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() { | |
window.UAParserBackup = window.UAParser | |
}).call(this), | |
function(t) { | |
"use strict"; | |
var e = t.userAgent = function(t) { | |
function e(t) { | |
var e = {}, | |
i = /(dolfin)[ \/]([\w.]+)/.exec(t) || /(chrome)[ \/]([\w.]+)/.exec(t) || /(opera)(?:.*version)?[ \/]([\w.]+)/.exec(t) || /(webkit)(?:.*version)?[ \/]([\w.]+)/.exec(t) || /(msie) ([\w.]+)/.exec(t) || t.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+))?/.exec(t) || ["", "unknown"]; | |
return "webkit" === i[1] ? i = /(iphone|ipad|ipod)[\S\s]*os ([\w._\-]+) like/.exec(t) || /(android)[ \/]([\w._\-]+);/.exec(t) || [i[0], "safari", i[2]] : "mozilla" === i[1] ? /trident/.test(t) ? i[1] = "msie" : i[1] = "firefox" : /polaris|natebrowser|([010|011|016|017|018|019]{3}\d{3,4}\d{4}$)/.test(t) && (i[1] = "polaris"), e[i[1]] = !0, e.name = i[1], e.version = n(i[2]), e |
This file contains hidden or 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
var observableStream = Rx.Observable.create(function(observer) { | |
observer.onNext(1); | |
}); | |
var subscriber = observableStream.subscribe(function(data) { | |
console.log('data', data); | |
if (data) { | |
subscriber.dispose(); | |
} |