Skip to content

Instantly share code, notes, and snippets.

View zrod's full-sized avatar
💻
Refactoring https://donating.io

Rodrigo zrod

💻
Refactoring https://donating.io
View GitHub Profile
@zrod
zrod / placeholder.fallback.js
Created November 4, 2011 16:41
Placeholder fallback (HMTL 5)
/*
* Small workaround to support the 'placeholder' attribute found on HTML5's input elements.
* This version requires jquery 1.6+
*/
var myScript = ( function( $ ) {
function placeHolderFallback() {
var forms = $( 'form' );
if ( forms.length > 0 ) {
@zrod
zrod / ieSelectFixedWidth.js
Created November 17, 2011 13:33
Fixed width for IE Select elements (< 9)
$(document).ready(function() {
if ($.browser.msie && $.browser.version.charAt(0) < 9) myScript.ieSelectFixedWidth('select.mini, select.medium');
}
// ...
var myScript = {
ieSelectFixedWidth: function(el) {
$(el).each(function(k, v) {
var obj = $(v);
@zrod
zrod / gist:1861309
Created February 18, 2012 23:22
Magento - nginx config
# Magento
server {
listen 80;
server_name store;
error_log /var/log/nginx/store.error_log;
root /home/rod/www/magento;
index index.php;
location / {
@zrod
zrod / jquery-pop.js
Created April 26, 2012 02:51
jQuery and pop
var selection = jQuery([ "item1", "item2", "item3" ]),
pop = [].pop;
console.log( pop.call( selection ), selection.length, selection[1] );
// output: "item3" 2 "item2"
@zrod
zrod / ttpopover.js
Created May 13, 2012 17:30
ttpopover.js - A small (and yet in dev) jQuery popover plugin
/**
* ttpopover.js v0.2
* TT PopOver plugin
* @author Rodrigo Z. Arthuso
*
* Requires jQuery 1.7+, mustache.js 0.5+
*
* @TODO Review update position on resize
*/
@zrod
zrod / main.js
Created July 18, 2012 01:18 — forked from fivetanley/main.js
requirejs configuration example
( function() {
var myLoader = require.config( {
baseUrl: '/js'
// any other settings here.
});
myLoader( [ 'list', 'of', 'deps' ], function( dep1, dep2, dep3 ) {
/* do stuff here */
});
}())
@zrod
zrod / uri.js
Created October 16, 2012 02:29 — forked from jlong/uri.js
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
/**
* st/filemanager.js
* FileManager
*
* Dependencies:
* - jQuery
* - StoryTroop (st/storytroop)
* - StoryTroop.ui (st/ui)
* - Mustache (lib/mustache-wp)
*/
@zrod
zrod / gist:4251777
Created December 10, 2012 16:54
"Replace" master with another branch
In the unfortunate case where a branch other than master is often used - or becomes the new "master" - and a replacement of master with it is required, execute the following codes:
git checkout branchie
git merge -s ours master
git checkout master
git merge branchie
@zrod
zrod / git-credentials-cache
Last active December 15, 2015 01:19
Git credentials
(1.7.9+)
Stores password in cache for 15 minutes (default):
git config --global credential.helper cache
Define custom timeout:
git config credential.helper 'cache --timeout=3600'
OS Keystore:
git config --global credential.helper osxkeychain