This is my first gist
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
- (void)setupCamera | |
{ | |
self.coreImageContext = [CIContext contextWithOptions:nil]; | |
// session | |
self.cameraSession = [[AVCaptureSession alloc] init]; | |
[self.cameraSession setSessionPreset:AVCaptureSessionPresetPhoto]; | |
[self.cameraSession commitConfiguration]; | |
// input |
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
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context | |
{ | |
if ([keyPath isEqualToString:@"currentUser"]) { | |
if (self.currentUser) { | |
[self hopTo:@"main" then:nil]; | |
} | |
else { | |
[self hopTo:@"signup_login" then:nil]; | |
} | |
} |
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
- (void)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
[self hopTo:@"splash" then:^{ | |
[self hopTo:@"onboarding" then:^{ | |
[self login]; | |
}]; | |
}]; | |
} |
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 csvdb = require('csvdb'); | |
var express = require('express'); | |
var path = require('path'); | |
// | |
// Returns an `express` middleware that can used to | |
// `source` is the url of the csv source (required) | |
// `options.filter` is a function called for each entry in `source` and allows one to filter the served results (default is no filter). | |
// `options.autofetch` is an interval for autofetching from source (default 5000ms). | |
// `options.view` is the name of a view to render when requests come in with `http` in their `accept` header (optional). |
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
#!/usr/bin/env node | |
function trace(base) { | |
return function() { | |
console.log('called at:', new Error().stack.split('\n')[2].trim()); | |
return base.apply(this, arguments); | |
}; | |
} | |
var path = require('path'); | |
path.exists = trace(path.exists); |
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
#!/bin/bash | |
mkdir -p ~/uijsdev | |
cd ~/uijsdev | |
git clone git@github.com:eladb/uijs | |
git clone git@github.com:eladb/uijs-controls | |
git clone git@github.com:eladb/uijs-devtools | |
cd uijs-devtools | |
npm install -g . | |
cd ../uijs | |
npm link |
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
// a simple drawing function | |
module.exports = function(ctx) { | |
ctx.fillStyle = 'red'; | |
ctx.fillRect(10, 10, 100, 100); | |
ctx.fillStyle = 'blue'; | |
ctx.fillRect(20, 20, 90, 90); // make inner box bigger | |
}; |
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 Canvas = require('canvas'); | |
var hello = require('./hello'); | |
// tests the `hello` rendering function | |
module.exports = function() { | |
var canvas = new Canvas(120, 120); | |
var ctx = canvas.getContext('2d'); | |
// call `hello` to do it's magic | |
hello(ctx); |
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
// a simple drawing function | |
module.exports = function(ctx) { | |
ctx.fillStyle = 'red'; | |
ctx.fillRect(10, 10, 100, 100); | |
ctx.fillStyle = 'blue'; | |
ctx.fillRect(20, 20, 80, 80); | |
}; |