// 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
| def factorial(number: Int) : Int = { | |
| def factorialWithAccumulator(accumulator: Int, number: Int) : Int = { | |
| if (number == 1) | |
| return accumulator | |
| else | |
| factorialWithAccumulator(accumulator * number, number - 1) | |
| } | |
| factorialWithAccumulator(1, number) | |
| } | |
| println(factorial(5)) |
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
| class FunctorObject { | |
| constructor (obj) { | |
| this.value = obj; | |
| } | |
| map (func) { | |
| const obj = {}; | |
| for (const key of Object.keys(this.value)) { | |
| obj[key] = func(this.value[key]); | |
| } |
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; |