This file contains 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
scope.greeting = 'hi there'; | |
var getGreeting = function(scope) { | |
return scope.greeting; | |
}; | |
scope.$watch(getGreeting, function(greeting) { | |
console.log('greeting: ', greeting); // greeting: hi there | |
}); |
This file contains 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
(define (permutations s) | |
(if (null? s) | |
(list s) | |
(flatmap (lambda (x) | |
(map (lambda (p) (cons x p)) | |
(permutations (remove x s)))) | |
s))) | |
; Helper methods |
This file contains 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
<div ng-switch-when="isEdit" class="edit-ad-wrapper" | |
ng-init="vm.heading = vm.getAdHeading({ad: vm._adBeingEdited}); vm.caption = vm.getAdCaption({ad: vm._adBeingEdited})"> | |
<tl-circular-checkbox class="check-toggle-wrapper" | |
is-checked="true"> | |
</tl-circular-checkbox> | |
<div class="image" style="background-image:url({{ ::vm.getAdImageUrl({ad: vm._adBeingEdited}) }})"> | |
</div> | |
<div class="edit-fields-wrapper"> | |
<ad-preview-form-heading class="form-heading-wrapper" label="Heading" | |
num-characters="vm.heading.length"> |
This file contains 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
/** | |
* Transform an object from one basis to another - i.e map keys - using a specification | |
* @param {Object[]} specification - a collection of objects specifying relationship | |
* @param {Object} options | |
* @param {String} options.from - name of source key | |
* @param {String} options.to - name of target key | |
* @param {Object} hash - subject of the basis change | |
* @return {Object} - new object with new set of keys | |
* | |
* @example |
This file contains 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 binaryTreeFactory = (function() { | |
return function create(source, isLeft) { | |
isLeft = isLeft || lessThan; | |
var root = seed(source.slice() /* shallow copy */, isLeft); | |
return { | |
insert: function(thing) { | |
insertNode(root, makeNode(thing), isLeft); | |
}, |
This file contains 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
<?php | |
abstract class Assert | |
{ | |
function strictlyEquals($a, $b) | |
{ | |
echo $a === $b ? 'Sure does' : 'Sure doesnt'; | |
} | |
function kindaEquals($a, $b) |
This file contains 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
interface Reducer { | |
(state: object, action: object): object | |
} | |
interface Reducers { | |
[key: string]: Reducer | |
} | |
/** | |
* Combine map of reducers keyed off of state key |
This file contains 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 * as React from 'react'; | |
import { mapValues } from 'lodash'; | |
/** | |
* All action objects must have a 'type' key | |
*/ | |
interface ActionSync { | |
type: any; | |
} |
This file contains 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
interface CallbackWithNameParameter { | |
cb: (name: string) => void | |
} | |
type CallbackWithNoParameter = () => void; | |
const aCallbackWithNoParameter: CallbackWithNoParameter = () => {}; | |
const aCallback: CallbackWithNameParameter = { // okay | |
cb: aCallbackWithNoParameter | |
}; |
This file contains 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
store.creativeLibraries = [{ | |
... | |
},{ | |
'id': 4855, | |
'active': 1, | |
'deleted': 0, | |
'name': 'new scroll ad (copied)', | |
'member_id': null, | |
'advertiser_id': 1092, | |
'brand_id': null, |