Skip to content

Instantly share code, notes, and snippets.

View eladb's full-sized avatar
☁️
winging it

Elad Ben-Israel eladb

☁️
winging it
View GitHub Profile
- (void)setupCamera
{
self.coreImageContext = [CIContext contextWithOptions:nil];
// session
self.cameraSession = [[AVCaptureSession alloc] init];
[self.cameraSession setSessionPreset:AVCaptureSessionPresetPhoto];
[self.cameraSession commitConfiguration];
// input
- (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];
}
}
- (void)viewDidLoad
{
[super viewDidLoad];
[self hopTo:@"splash" then:^{
[self hopTo:@"onboarding" then:^{
[self login];
}];
}];
}
@eladb
eladb / hello.md
Created January 21, 2014 14:40
Test gist.io

Hello

This is my first gist

@eladb
eladb / express-csvdb.js
Created September 11, 2012 12:32
node-express-csvdb
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).
@eladb
eladb / trace.js
Created September 1, 2012 08:27
Who calls `path.exists`?
#!/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);
@eladb
eladb / install.sh
Created September 1, 2012 08:11
Hello uijs
#!/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
@eladb
eladb / hello-2.js
Created July 4, 2012 09:19
cantest - hello-2.js
// 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
};
@eladb
eladb / hello-test.js
Created July 4, 2012 09:04
cantest - hello-test
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);
@eladb
eladb / hello.js
Created July 4, 2012 08:55
cantest - hello
// 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);
};