Skip to content

Instantly share code, notes, and snippets.

View yeco's full-sized avatar

Jasson Cascante yeco

View GitHub Profile
@yeco
yeco / gist:9223795
Created February 26, 2014 05:00 — forked from gf3/gist:328089
Black: 0, 0, 0
Red: 229, 34, 34
Green: 166, 227, 45
Yellow: 252, 149, 30
Blue: 196, 141, 255
Magenta: 250, 37, 115
Cyan: 103, 217, 240
White: 242, 242, 242
@yeco
yeco / dates.js
Created February 13, 2014 05:39
An small date utility tool belt.
var dates = {
convert:function(d) {
// Converts the date in d to a date-object. The input can be:
// a date object: returned without modification
// an array : Interpreted as [year,month,day]. NOTE: month is 0-11.
// a number : Interpreted as number of milliseconds
// since 1 Jan 1970 (a timestamp)
// a string : Any format supported by the javascript engine, like
// "YYYY/MM/DD", "MM/DD/YYYY", "Jan 31 2009" etc.
// an object : Interpreted as an object with year, month and date
@yeco
yeco / gist:8910987
Last active August 29, 2015 13:56 — forked from nickserv/gist:8482253

Homesick Reference

homesick cd CASTLE              # Open a new shell in the root of the given castle
homesick clone URI              # Clone +uri+ as a castle for homesick
homesick commit CASTLE MESSAGE  # Commit the specified castle's changes
homesick destroy CASTLE         # Delete all symlinks and remove the cloned repository
homesick diff CASTLE            # Shows the git diff of uncommitted changes in a castle
homesick generate PATH          # generate a homesick-ready git repo at PATH
homesick help [COMMAND]         # Describe available commands or one specific command
homesick list                   # List cloned castles
@yeco
yeco / tapis.js
Created October 30, 2013 02:07
Tapis.JS Bookmarklet
javascript: (function() {
var docBody = document.body,
pNode = docBody.parentNode,
node = docBody.cloneNode(true);
pNode.appendChild(node);
pNode.style.overflow = 'hidden';
styles = node.style;
styles.width = '100%';
styles.position = 'absolute';
styles.top = 0;
App.PickADate = Ember.View.extend({
attributes: ['monthsFull', 'monthsShort', 'weekdaysFull', 'weekdaysShort',
'monthPrev', 'monthNext', 'showMonthsFull', 'showWeekdaysShort', 'today',
'clear', 'format', 'formatSubmit', 'hiddenSuffix', 'firstDay', 'monthSelector',
'yearSelector', 'dateMin', 'dateMax', 'datesDisabled', 'disablePicker'],
events: ['onOpen', 'onClose', 'onSelect', 'onStart'],
tagName: 'input',
classNames: 'pickadate',
@yeco
yeco / findQuery.js
Created September 24, 2013 04:49
Ember-Model findQuery for FixtureAdapter
App.FixtureAdapter = Ember.FixtureAdapter.extend({
findQuery: function(klass, records, params) {
var fixtures = klass.FIXTURES,
data = Ember.A(fixtures);
var requestedData = data.filter(function(item) {
for (var prop in params) {
if (item[prop] !== params[prop]) {
return false;
}
@yeco
yeco / Preferences.sublime-settings.json
Last active December 23, 2015 02:09
My Sublime Settings
{
// Sets the colors used within the text area
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
// Note that the font_face and font_size are overriden in the platform
// specific settings file, for example, "Base File (Linux).sublime-settings".
// Because of this, setting them here will have no effect: you must set them
// in your User File Preferences.
"font_face": "Monaco",
"font_size": 12,
@yeco
yeco / App.ChosenSelect.js
Last active December 22, 2015 17:19
Chosen.js v0.12 implementation in Ember 1.0.0.
App.ChosenSelect = Ember.Select.extend({
chosenOptions: {width:'100%', search_contains: true},
multiple:true,
attributeBindings:['multiple'],
didInsertElement: function(){
var view = this;
this._super();
view.$().chosen(view.get('chosenOptions'));
var net = require('net');
// Hace una lista de la gente en el room
var clients = [];
var server = net.createServer(function(sock){
// Cuando el socket se conecta hacemos unas cuantas cosas...
// 1. Establecer un listener para cuando alguien cierre sea removido de la lista
sock.on('end', function(){
var net = require('net');
var clients = [];
var server = net.createServer(function(sock){
sock.on('end', function(){
clients.splice(clients.indexOf(sock), 1);
});
clients.forEach(function(i){
sock.pipe(i).pipe(sock);
});