Skip to content

Instantly share code, notes, and snippets.

View caiovaccaro's full-sized avatar
✌️

Caio Vaccaro caiovaccaro

✌️
View GitHub Profile
@caiovaccaro
caiovaccaro / gist:65dd39848dc4308f2cf5
Last active August 29, 2015 14:19 — forked from berzniz/gist:2900905
Load Handlebars templates with partial dependencies
Handlebars.getTemplate = function(name, partialDependencies) {
if(typeof partialDependencies !== 'undefined') {
for (var i = partialDependencies.length - 1; i >= 0; i--) {
var partialName = partialDependencies[i];
if (Handlebars.partials === undefined || Handlebars.partials[partialName] === undefined) {
$.ajax({
url : '/assets/templates/partials/' + partialName + '.handlebars',
success : function(data) {
Handlebars.registerPartial(partialName, data);
@caiovaccaro
caiovaccaro / rdio_collection_export.js
Last active August 29, 2015 14:02
bookmarklet to export rdio ##Collection## to ivy
javascript:(function() {
var bookmarklet = {
init: function() {
this.parse();
},
parse: function() {
page = "";
$.each($(".SourceList:visible").find(".Track"), function() {
line = [];
function buildLine() {
@caiovaccaro
caiovaccaro / rdio_playlist_export.js
Last active August 29, 2015 14:02
bookmarklet to export rdio ##Playlist## to ivy
javascript:(function() {
var bookmarklet = {
init: function() {
this.parse();
},
parse: function() {
page = "";
$(".Collection:visible")
.children(".ListItem")
.find(".Track")
@caiovaccaro
caiovaccaro / jstarter.js
Created May 22, 2014 17:47
JS Starter. Initialize every function of objects inside your NAMESPACE (change that). Does not initialize init functions or functions that begins with _. Uses jQuery .each
NAMESPACE.Start = function() {
$.each(NAMESPACE, function(obj,v) {
if(obj !== 'Start')
$.each(NAMESPACE[obj], function(func, v) {
if(typeof NAMESPACE[obj][func] !== 'undefined' &&
func !== 'init' && func.indexOf('_') !== 0 &&
typeof NAMESPACE[obj][func] === 'function') NAMESPACE[obj][func]();
});
});
};
@caiovaccaro
caiovaccaro / git-assume-unchanged
Created April 28, 2014 14:14
git-assume-unchanged
git update-index --assume-unchanged file.extension
@caiovaccaro
caiovaccaro / wpXmlSplitter.py
Created January 12, 2014 03:38
Wordpress XML Splitter in Python. Not written by me (http://wordpress.org/support/profile/eerac). If the script says there is no items, check the delimiter variable (one or more tabs /t)
#!/usr/bin/python
# This script is designed to take a wordpress xml export file and split it into some
# number of chunks (2 by default). The number of lines per chunk is determined by counting
# the number of occurences of a particular line, '<item>\n' by default, and breaking up the
# such that each chunk has an equal number occurences of that line. The appropriate header
# and footer is added to each chunk.
import os
import sys