The scope of a variable is the region of the program in which you can directly access the variable:
if (true) {
let x = 123;
}
Here, the scope of x
is the then-block of this if-then-else statement.
#!/usr/bin/env bash | |
cd <projectDir> | |
currentBranch=$(git rev-parse --abbrev-ref HEAD) | |
git checkout master | |
git pull | |
git checkout $currentBranch | |
git rebase master |
The scope of a variable is the region of the program in which you can directly access the variable:
if (true) {
let x = 123;
}
Here, the scope of x
is the then-block of this if-then-else statement.
package com.username.ussd; | |
import android.app.Service; | |
import android.content.Intent; | |
import android.content.SharedPreferences; | |
import android.os.IBinder; | |
import android.os.RemoteException; | |
import android.preference.PreferenceManager; | |
import android.util.Log; | |
import { Component } from "React"; | |
export default (ComposedComponent) => class extends Component { | |
constructor(props) { | |
super(props); | |
this.state = { data: null }; | |
} | |
componentDidMount() { | |
this.setState({ data: 'Hello' }); | |
} |
injc=(src,cbk) => { let script = document.createElement('script');script.src = src;document.getElementsByTagName('head')[0].appendChild(script);script.onload=()=>cbk() } | |
injc("https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react.min.js",() => injc("https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.min.js",() => console.log("ready"))) |
A tiny (265 byte) utility to create state machine components using two pure functions.
The API is a single function that accepts 2 pure functions as arguments:
import Reconciler from 'react-reconciler' | |
import omit from 'lodash/omit' | |
import capitalize from 'lodash/capitalize' | |
import { actions as elementActions } from './store/elements' | |
import * as Elements from './elements' | |
const roots = new Map() | |
const emptyObject = {} | |
const Renderer = Reconciler({ |
export const GoogleApi = function(opts) { | |
opts = opts || {} | |
const apiKey = opts.apiKey; | |
const libraries = opts.libraries || []; | |
const client = opts.client; | |
const URL = 'https://maps.googleapis.com/maps/api/js'; | |
const googleVersion = '3.22'; | |
let script = null; |
/* | |
* Natural Sort algorithm for Javascript - Version 0.7 - Released under MIT license | |
* Author: Jim Palmer (based on chunking idea from Dave Koelle) | |
* Reference: http://www.overset.com/2008/09/01/javascript-natural-sort-algorithm/ | |
*/ | |
function naturalSort (a, b) { | |
var re = /(^-?[0-9]+(\.?[0-9]*)[df]?e?[0-9]?$|^0x[0-9a-f]+$|[0-9]+)/gi, | |
sre = /(^[ ]*|[ ]*$)/g, | |
dre = /(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/, | |
hre = /^0x[0-9a-f]+$/i, |