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
| const arr1 = [1,2,3] | |
| const arr2 = [4,5,6] | |
| const arr3 = [...arr1, ...arr2] //arr3 ==> [1,2,3,4,5,6] |
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 moment = require('moment'); // http://momentjs.com/docs/ | |
| var _ = require('lodash'); // https://lodash.com/docs | |
| function(collectionsWithDateValues){ | |
| var slots = []; | |
| var hours = { | |
| start: 7, // 7am | |
| end: 21, // 9pm | |
| window: 2 // How long each item should be slotted for. | |
| }; |
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
| /* ~/Library/KeyBindings/DefaultKeyBinding.Dict | |
| This file remaps the key bindings of a single user on Mac OS X 10.5 to more | |
| closely match default behavior on Windows systems. This makes the Command key | |
| behave like Windows Control key. To use Control instead of Command, either swap | |
| Control and Command in Apple->System Preferences->Keyboard->Modifier Keys... | |
| or replace @ with ^ in this file. | |
| Here is a rough cheatsheet for syntax. | |
| Key Modifiers |
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
| //** In web app **// | |
| var current = constants.STATE_WAITING; |
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
| static UIImage * UIImageForSwatchOfColorWithSize(UIColor *color, CGSize size) { | |
| UIImage *image = nil; | |
| CGRect rect = CGRectMake(0.0f, 0.0f, size.width, size.height); | |
| UIGraphicsBeginImageContext(rect.size); | |
| { | |
| CGContextRef c = UIGraphicsGetCurrentContext(); | |
| CGContextSetFillColorWithColor(c, [color CGColor]); |
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 canvas, stage, exportRoot; | |
| function init() { | |
| canvas = document.getElementById("canvas"); | |
| //Setup the canvas widht and height with devicePixelRatio. And set CSS width and height properties. | |
| var w = 320; | |
| var h = 357; | |
| canvas.width = w * window.devicePixelRatio; | |
| canvas.height = h * window.devicePixelRatio; |
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
| <html ng-app="test"> | |
| <head> | |
| <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.1.1/angular.min.js"></script> | |
| <script type="text/javascript" src="https://cdn.firebase.com/v0/firebase.js"></script> | |
| </head> | |
| <body ng-controller="Test"> | |
| <script typ="text/javascript"> | |
| function TestController($scope, $q) { | |
| this._q = $q; | |
| this._scope = $scope; |
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 map(x, in_min, in_max, out_min, out_max) { | |
| return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; | |
| } |
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 db = new Firebase('https://demo.firebaseio.com') | |
| var authenticate = (function(db) { | |
| var loggedIn, | |
| deferred = $.Deferred() | |
| var client = new FirebaseAuthClient(db, function(err, user) { | |
| loggedIn = !!user | |
| if (err) { |
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
| // Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc | |
| // jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/ | |
| // author: Pawel Kozlowski | |
| var myApp = angular.module('myApp', []); | |
| //service style, probably the simplest one | |
| myApp.service('helloWorldFromService', function() { | |
| this.sayHello = function() { | |
| return "Hello, World!" |