Skip to content

Instantly share code, notes, and snippets.

View berzniz's full-sized avatar

Tal Bereznitskey berzniz

View GitHub Profile
- (void)viewDidLoad
{
[super viewDidLoad];
[self observeModel]
[self render];
}
- (void)observeModel
{
// KVO is used to observe model changes
Backbone.easyXDMxhr = new easyXDM.Rpc({
remote: 'http://foo.bar/cors/',
}, {
remote: {
request: {}
}
});
Backbone.ajax = function() {
var options = arguments[0];
NSString *command = @"ok glass, take a picture";
AVSpeechSynthesizer *synthesizer = [[AVSpeechSynthesizer alloc] init];
AVSpeechUtterance *utterance = [AVSpeechUtterance speechUtteranceWithString:command];
[synthesizer speakUtterance:utterance];
//
// TBKeychainCounter.h
//
// Created by Tal Bereznitskey on 5/11/13.
// Copyright (c) 2013 Tal Bereznitskey. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface TBKeychainCounter : NSObject
// component A
const a = () => (
<Overdrive id="bender-to-fry">
<img src="bender.img"/>
</Overdrive>
);
// component B
const b = () => (
<Overdrive id="bender-to-fry">
@berzniz
berzniz / gist:2900905
Created June 9, 2012 13:01
handlebars3
Handlebars.getTemplate = function(name) {
if (Handlebars.templates === undefined || Handlebars.templates[name] === undefined) {
$.ajax({
url : 'templatesfolder/' + name + '.handlebars',
success : function(data) {
if (Handlebars.templates === undefined) {
Handlebars.templates = {};
}
Handlebars.templates[name] = Handlebars.compile(data);
},
@berzniz
berzniz / react.jsx
Last active March 28, 2018 20:09
Example for "Update on Async Rendering"
class Example extends React.Component {
componentDidMount () {
this.fetchData(this.props)
}
componentWillReceiveProps (props) {
if (props.id !== this.props.id) {
this.fetchData(props)
}
}
@berzniz
berzniz / gist:2045615
Created March 15, 2012 17:52
Adding a global notification system to backbone.js
Backbone.Notifications = {};
_.extend(Backbone.Notifications, Backbone.Events);
@berzniz
berzniz / NSObject+Debounce.h
Created January 25, 2014 16:18
Debounce method for Objective C
@interface NSObject (Debounce)
- (void)debounce:(SEL)action delay:(NSTimeInterval)delay;
@end
@berzniz
berzniz / config.yml
Created June 6, 2018 07:55
Starter CircleCI v2 configuration for Node.js apps
version: 2.0
jobs:
test:
docker:
- image: circleci/node:8.10
working_directory: ~/circleci-build
environment:
EXAMPLE_ENV_FOR_TESTING: "test"
steps: