Skip to content

Instantly share code, notes, and snippets.

View snit-ram's full-sized avatar

Rafael Martins snit-ram

View GitHub Profile
@snit-ram
snit-ram / todo.fish
Created April 9, 2014 21:18
function for searching for common TODO patterns using ag
function todo
ag $argv "TODO|FIXME|NOTE|CHANGED|@todo"
end
@snit-ram
snit-ram / grunt.fish
Last active August 29, 2015 14:06
Fish grunt completion
# Completion for grunt
# Modified version by snit
# place this file at ~/.config/fish/completions/grunt.fish
# grunt-cli
# http://gruntjs.com/
#
# Copyright (c) 2012 Tyler Kellen, contributors
# Licensed under the MIT license.
# https://github.com/gruntjs/grunt/blob/master/LICENSE-MIT
@snit-ram
snit-ram / RecursiveArrayIterator.php
Created September 27, 2011 02:18
Recursive Object iterator that reads protected and private properties
<?php
class ObjectIterator implements Iterator{
protected $object;
protected $reflectionObject;
protected $properties;
public function __construct( $object ){
$this->object = $object;
@snit-ram
snit-ram / 0-howto-listfield-django-admin.rst
Created November 16, 2011 02:51 — forked from jonashaag/0-howto-listfield-django-admin.rst
Howto use ListFields in Django's admin

Howto use ListFields in Django's admin

Problem

Consider this blog post model:

models.py

:

@snit-ram
snit-ram / nodefix.common.js
Created May 11, 2012 16:14
Workaround to binder tests on mojito or nodejs-yui3
/*
* This file allows you to write binder tests using node.one(selector) in your
* mojito binder tests. simple add 'nodefix' to your "requires" on bindertests
* then use it like this:
*
* var node = Y.NodeFix.create('<div><p>sample child<p></div>')
* binder.bind(node);
*
* Then all the usage of node.one and node.all inside the binder will work as
* expected
@snit-ram
snit-ram / gist:3515501
Created August 29, 2012 16:48
Javascript code to hide elements from a list when scrolling. This is designed to improve performance on native scrolling lists for iphone/ipad.
/**
* Hides all elements that are outside the scrolling viewport to improve
* performance.
*
* You'll need to call this function whenever dom nodes are inserted or removed
* in the list.
*
* You'll need to declare the "unload" class in your css file as following:
* .unload { visibility: hidden; }
*
@snit-ram
snit-ram / gist:4557947
Created January 17, 2013 17:49
Javascript port of object selector originally in php
/*
* Copyright (c) 2011 Yahoo! Inc. All rights reserved.
*/
/*jslint nomen: true */
(function () {
'use strict';
function mix(target, source){
@snit-ram
snit-ram / gist:4666222
Last active December 11, 2015 21:58
Combined List Projection. Combines items with groups
// For an introduction to the Blank template, see the following documentation:
// http://go.microsoft.com/fwlink/?LinkId=232509
(function () {
"use strict";
WinJS.Binding.optimizeBindingReferences = true;
var app = WinJS.Application;
var activation = Windows.ApplicationModel.Activation;
@snit-ram
snit-ram / position-absolute.css
Created March 8, 2013 03:24
CSS for the position absolute article
html, body{
margin: 0;
padding: 0;
}
#dialog {
width: auto;
top: 50px;
left: 50px;
right: 50px;
@snit-ram
snit-ram / position-absolute.html
Created March 8, 2013 03:17
Html for the position absolute article
<div id="dialog">
<div id="navegacao"></div>
<div id="cabecalho"></div>
<div id="conteudo"></div>
<div id="rodape"></div>
</div>