Skip to content

Instantly share code, notes, and snippets.

@dcluna
dcluna / raskell.rb
Created August 21, 2012 18:16 — forked from andkerosine/raskell.rb
Haskell-like list comprehensions in Ruby
$stack, $draws = [], {}
def method_missing *args
return if args[0][/^to_/]
$stack << args.map { |a| a or $stack.pop }
$draws[$stack.pop(2)[0][0]] = args[1] if args[0] == :<
end
class Array
def +@
@dcluna
dcluna / gist:3436398
Created August 23, 2012 13:06
testa_advanced_dash2
#!/usr/bin/env ruby
require 'cgi'
json = "{'action':'UpdateTicketPriority', 'params':{'TICKETID':'1001','INTERNAL_PRIORITY':'1'}}"
base_url = "http://10.1.1.172:7001/advdash2data/ActionService?json_req="
encoded_json = CGI.encode(json)
full_url = base_url + encoded_json
@dcluna
dcluna / ideavimrc
Last active August 29, 2015 14:16 — forked from RobertAudi/ideavimrc
.ideamvimrc remapping copy actions to use the system clipboard
nnoremap yy "+yy
vnoremap y "+y
nnoremap p "+p
vnoremap p "+p
nnoremap P "+P
vnoremap P "+P
@dcluna
dcluna / Android.xml
Created March 3, 2015 22:29
AndroidStudio live templates
<?xml version="1.0" encoding="UTF-8"?>
<templateSet group="Android">
<template name="resolveIntent" value="if($INTENT$.resolveActivity($PACMAN$) != null){&#10; $END$&#10;}" description="Checks if an intent should be" toReformat="false" toShortenFQNames="true">
<variable name="INTENT" expression="suggestVariableName()" defaultValue="intent" alwaysStopAt="true" />
<variable name="PACMAN" expression="variableOfType(&quot;PackageManager&quot;)" defaultValue="getPackageManager()" alwaysStopAt="true" />
<context>
<option name="JAVA_CODE" value="true" />
<option name="JAVA_STATEMENT" value="true" />
<option name="JAVA_EXPRESSION" value="true" />
<option name="JAVA_DECLARATION" value="true" />
@dcluna
dcluna / Material Design Colors
Last active August 29, 2015 14:16 — forked from cypressious/Material Design Colors
Android Google colors
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="red_50">#fde0dc</color>
<color name="red_100">#f9bdbb</color>
<color name="red_200">#f69988</color>
<color name="red_300">#f36c60</color>
<color name="red_400">#e84e40</color>
<color name="red_500">#e51c23</color>
<color name="red_600">#dd191d</color>
<color name="red_700">#d01716</color>
@dcluna
dcluna / gist:58c8ba5137fe665ca3ad
Last active August 29, 2015 14:17 — forked from esoergel/gist:782725cd6c8956fc9d21
hammer function for commcare-hq
function hammer() {
git checkout master
git pull origin master
git submodule update --init --recursive
pip install -r requirements/requirements.txt -r requirements/dev-requirements.txt -r ⤷ requirements/prod-requirements.txt
find . -name '*.pyc' -delete
./manage.py syncdb --migrate
}
@dcluna
dcluna / giffify.sh
Last active August 29, 2015 14:25 — forked from rock3r/giffify.py
Giffify - easily create optimised GIFs from a video
#!/bin/sh
# License for any modification to the original (linked below):
# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# Sebastiano Poggi wrote this file. As long as you retain this notice you
# can do whatever you want with this stuff. If we meet some day, and you think
# this stuff is worth it, you can buy me a beer in return.
# ----------------------------------------------------------------------------
#
# Based upon http://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html
@dcluna
dcluna / pre-push
Created August 5, 2015 15:57
pre-push hook for Android projects - checks if you're pushing something that builds
#!/bin/sh
# An example hook script to verify what is about to be pushed. Called by "git
# push" after it has checked the remote status, but before anything has been
# pushed. If this script exits with a non-zero status nothing will be pushed.
#
# This hook is called with the following parameters:
#
# $1 -- Name of the remote to which the push is being done
# $2 -- URL to which the push is being done
@dcluna
dcluna / reg-fix-window-frame-config.patch
Last active August 29, 2015 14:26
patch for evil-register-list when there are non-numeric registers
# HG changeset patch
# User dancluna@dcl-notebook
# Date 1439007089 10800
# Sat Aug 08 01:11:29 2015 -0300
# Node ID 90103760c012a319827006b4957fcd1b370b2d7d
# Parent 565bb35acf785f28abd654eba4cc34ef96a1c6ac
Removing list-like entries from register-alist in calls to evil-register-list, to avoid errors with window/frame configuration objects saved in registers.
diff -r 565bb35acf78 -r 90103760c012 evil-common.el
--- a/evil-common.el Mon Jul 06 16:12:31 2015 +0200
@dcluna
dcluna / git-check-empty-staging-area.sh
Created August 10, 2015 19:24
Checks if staging area for git directories given through stdin is empty
#!/bin/bash
# This script checks if the staging area for git directories in $1 is empty
while read line; do
dir=$line
curdir=$PWD
cd $dir
gitroot=`git rev-parse --show-toplevel`
cd $gitroot
# echo "Currently in git root $PWD"