Skip to content

Instantly share code, notes, and snippets.

@decklord
decklord / header.html
Last active December 22, 2015 21:19
Code snippet for syntax highlight in Tumblr
<!-- Base For Syntax Highlight -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" type="text/javascript"></script>
<script src="http://google-code-prettify.googlecode.com/svn/trunk/src/prettify.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="http://google-code-prettify.googlecode.com/svn/trunk/src/prettify.css"></link>
<!-- Loads a nice template for syntax highlight -->
<!-- Get more templates on: http://google-code-prettify.googlecode.com/svn/trunk/styles/index.html -->
<link rel="stylesheet" type="text/css" href="https://google-code-prettify.googlecode.com/svn/trunk/styles/sons-of-obsidian.css"></link>
<script type="text/javascript">
@decklord
decklord / sublime-settings.json
Last active December 28, 2015 05:49
This is my sublime settings file
{
"auto_indent": true,
"color_scheme": "Packages/Tomorrow Color Schemes/Tomorrow-Night.tmTheme",
"draw_white_space": "all",
"font_face": "Ubuntu Mono",
"font_options":
[
"subpixel_antialias",
"gray_antialias"
],
@decklord
decklord / .zshrc
Last active December 29, 2015 04:38
ZSH Config File
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
#bind '"\e[A": history-search-backward'
#bind '"\e[B": history-search-forward'
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="robbyrussell"
@decklord
decklord / circus_test.py
Created December 5, 2013 19:39
Load watcher on running CIRCUS instance.
from circus.client import CircusClient, make_message
from circus.util import DEFAULT_ENDPOINT_DEALER
client = CircusClient(endpoint=DEFAULT_ENDPOINT_DEALER)
virtual_env_dir = "/path/to/.virtualenvs/virtualenv/bin"
watcher_options = {
"numprocesses": 2,
"working_dir": "my/path/to/file",
@decklord
decklord / django-crossdomainxhr-middleware.py
Last active August 29, 2015 13:57 — forked from valsteen/django-crossdomainxhr-middleware.py
Enables to do cross domain requests with django
from django import http
from django.conf import settings
class XsSharingMiddleware(object):
"""
This middleware allows cross-domain XHR using the html5 postMessage API.
Access-Control-Allow-Origin: http://foo.example
Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, DELETE
"""
@decklord
decklord / rutValidator.js
Created February 4, 2015 17:52
Validador de Rut en Coffeescript
formatRut = (str) ->
str.replace(/\./g, '')
checkRut = (str) ->
if not str?
return false
str = str.toString().trim()
str = formatRut str
@decklord
decklord / cache.js
Created July 29, 2015 17:43
This file is a cache module for Appcelerator Platform, now it works just with images but can be extended to support other stuff. Currently supports n number of retries and gets the image path on a callback, so you don't need to fake a dummy imageView if you want to precache some image.
exports.image = function(url, callback, directory) {
if (directory === undefined) {
var directory = 'cachedImages';
}
var filename = Ti.Utils.md5HexDigest(url);
var file = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, directory, filename);

PostCenter

Git Culture: Code Reviews & Commits

Documentation is really important when done right. We must make it a smart process instead of doing it painfully. One good way to document the development process is with git: commits and code reviews. Here are some really good tips for improving our team's work and build a strong development methodology and philosophy.

Better Commits

From 5 Useful Tips For A Better Commit Message and Better Commit Messages with a .gitmessage Template

@decklord
decklord / angular_recursion_helper.js
Created March 13, 2017 14:25
Angular 1.x Recursion Helper
module.factory('RecursionHelper', ['$compile', function($compile){
return {
/**
* Manually compiles the element, fixing the recursion loop.
* @param element
* @param [link] A post-link function, or an object with function(s) registered via pre and post properties.
* @returns An object containing the linking functions.
*/
compile: function(element, link){
// Normalize the link parameter
module.factory('RecursionHelper', ['$compile', function($compile){
return {
/**
* Author: Mark Lagendijk from Stack Overflow
* Reference: http://stackoverflow.com/questions/14430655/recursion-in-angular-directives
* Manually compiles the element, fixing the recursion loop.
* @param element
* @param [link] A post-link function, or an object with function(s) registered via pre and post properties.
* @returns An object containing the linking functions.
*/