Skip to content

Instantly share code, notes, and snippets.

View Schniz's full-sized avatar

Gal Schlezinger Schniz

View GitHub Profile
@Schniz
Schniz / myshell.c
Created August 28, 2015 16:27
MyShell for Colman
// 203774823 Gal Schlezinger
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#define NUM_OF_ARGS 3
#define CLI_LENGTH 256
@Schniz
Schniz / function.proxy.js
Last active August 29, 2015 13:56
Give some context to your javascript functions.
/**
* usage: function() {}.proxy(bla)
* bla will be 'this' in the function context.
**/
Function.prototype.proxy = function(sup) {
var thiz = this;
var args = arguments;
return function() {
return thiz.apply(sup, args);
@Schniz
Schniz / mongoid.yml
Created March 13, 2014 22:55
Sinatra + Mongoid = ♥
development:
sessions:
default:
database: sinatraStam_test
hosts:
- localhost:27017
@Schniz
Schniz / bootstrap-ember-navlink.js
Last active August 29, 2015 13:57
For cleaning up Ember code.
@Schniz
Schniz / mongoid_json_patch.rb
Last active August 29, 2015 13:57
I've seen it somewhere.. and I've added the 'date_created' thing that you can't access when you're doing it all RESTy.
# Adds "id" and "date_created" to the mongoid document.
# "id" => "_id"
# "date_created" => "_id.generation_time"
# YEAH. thats it.
module Mongoid
module Document
def as_json(options={})
attrs = super(options)
attrs["id"] = self.persisted? ? self._id : nil
attrs["date_created"] = self.persisted? ? self._id.generation_time : nil
@Schniz
Schniz / ember-timeago.js
Last active August 29, 2015 13:57
momentjs + ember = {{timeago}} helper!
// ember-timeago.js
// Using momentjs to provide neat helper for fromNow() calls.
App.Clock = Em.Object.create({
seconds: 0,
minutes: 0,
hours: 0,
init: function() {
this.tick();
},
@Schniz
Schniz / README.md
Last active August 29, 2015 13:57
radial progressbar helper for Ember (using jQuery-Knob by @aterrien )

Hai!

This baby registers an Ember Handlebars helper using @aterrien's awesome jQuery-Knob

Usage:

{{radial-progress progress=myProgress}}

and vuala!!! you've got yourself a knob. options:

@Schniz
Schniz / README.md
Last active August 29, 2015 14:05
EmojiPicture react component. pretty basic but i needed this. It has the CJSX, JSX and JS equivalent.

EmojiPicture REACT COMPONENT!!!! WAT!!!

<EmojiPicture name="poop" height=100 width=100 />

for rendering a big poop on the client's screen. yay.

@Schniz
Schniz / flick.js
Created September 2, 2014 20:08
simple promises demonstration for Yoshi.
// USAGE:
// flick(function(willBeNull, next) { next("hey"); }).then(....).then(...);
var PPromise = function(callback) {
this.thenCallback = function() {};
this.next = function() {};
this.data = null;
this.resolved = false;
this.nextPromise = null;
}
@Schniz
Schniz / udi.js
Created September 14, 2014 14:46
Ember <3 for Udi
// {{source-wat}}
App.SourceWatComponent = Ember.Component.extend({
attributeBindings: ['draggable'],
draggable: 'true',
dragStart: function(e) {
console.log("drag start");
}
});
// {{dest-wat}}