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; | |
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 |
Angular directive code to help resize/redraw non-responsive elements (like D3 charts) in a bootstrap responsive design when the window moves across bootstrap boundaries.
(I edited my boostrap to create an extra size for some 7" tablets and landscape phones @ 600px)
What do you think? Good? Bad? Ugly? How could it be better? What other options exist?
Credit to tagtree for the Rickshaw directive help: http://tagtree.tv/d3-with-rickshaw-and-angular
import React from 'react' | |
import revalidation from 'revalidation' | |
import gql from 'graphql-tag.macro' | |
import { filter } from 'graphql-anywhere' | |
import { curry } from 'ramda' | |
import { compose, withProps, withHandlers } from 'recompose' | |
import { graphql } from 'react-apollo' | |
import { Button } from '../common/styled' | |
import { getValue } from '../form/utils' | |
import { isRequired } from '../../utils/validation' |
The power of a Static Typed language can seem magical at first. But the goal here is to take a tiny peak behind that curtain.
Elm's implementation of JSON parsing is type safe and how it achieves that can seem like a mystery. Even though I got the code to work, it took me a while to fully understand how it works.
I'm writing it down here for 2 reasons. To help others gain a greater understanding of Types and so I don't forget what I learned.
var myString = 'EXAMPLEstring'; | |
var myNewString = myString.replace(/[A-Z]/g, '0'); | |
console.log(myNewString); | |
function replaceFunc (a, b, c) { | |
console.log(a, b, c); | |
return a.toLowerCase(); | |
} | |
var myOtherString = myString.replace(/[A-Z]/g, replaceFunc); |
angular.module('angularApp'). | |
directive('dt', function(){ | |
return { | |
require: '?ngModel', | |
restrict: 'A', | |
link: function ($scope, element, attrs, controller) { | |
var updateModel, onblur; | |
if (controller !== null) { |