Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View esoergel's full-sized avatar

Ethan Soergel esoergel

View GitHub Profile
<head>
...
{% less "some/less/file.less" %}
{% js "some/js/file.js" %}
{% compress %}
<style type="text/less">
.inline_element {
.child_element {
color: red;
@esoergel
esoergel / gist:b017a9aa632e9433a2af
Created June 26, 2014 17:15
Collatz Conjecture in Haskell
collatzNaive :: Int -> [Int]
collatzNaive 1 = [1]
collatzNaive n = n:sequence
where sequence
| even n = collatzNaive (n `div` 2)
| otherwise = collatzNaive (n*3 + 1)
-- Store things as a linked list of tuples - [(1, 1), (2, 2), (3, 8), (4, 3)...]
addKV :: (Integral a) => [(a, a)] -> a -> a -> [(a, a)]
import Data.List
main :: IO ()
main = do
putStrLn "Enter a number"
number <- getLine
putStrLn $ longForm number
longForm n =
let ints = map makeInt n
// ==UserScript==
// @name FogBugz Timesheet Hours
// @namespace fb-ts-hours
// @description Calculate and display hours worked on FogBugz timesheet popup.
// https://gist.github.com/millerdev/96c9b824b8902d4a5c19
// @include http://manage.dimagi.com/*
// @version 1
// @grant none
// ==/UserScript==
function main() {
@esoergel
esoergel / Timecards
Last active August 29, 2015 14:06
Fogbugz Timecard comments
@namespace url(http://www.w3.org/1999/xhtml);
/* Don't collapse whitespace in Timecard comments */
@-moz-document domain("mail.google.com"), regexp("https?://manage.dimagi.com.*timecard.*") {
tr > td[colspan="8"] > div > div {
white-space: pre-wrap;
}
}
@esoergel
esoergel / github-ignore-whitespace.js
Last active June 17, 2017 01:55
Adds a button to github diffs to append ?w=1 to the diff url, ignoring whitespace.
// ==UserScript==
// @name Ignore whitespace button
// @namespace github-ignore-whitespace
// @description Adds a button to github diff views to toggle the "ignore whitespace" option.
// @include https://github.com/*
// @version 1
// @grant none
// ==/UserScript==
function main() {
$("#toc > .button-group").prepend('<a class="minibutton" href="?w=1">Ignore whitespace</a>');
@esoergel
esoergel / multiple_inheritance.py
Last active August 29, 2015 14:15
Python multiple inheritance
class A1(object):
def __init__(self):
print "Class A1"
super(A1, self).__init__()
class A2(A1):
def __init__(self):
print "Class A2"
super(A2, self).__init__()
@esoergel
esoergel / gist:782725cd6c8956fc9d21
Last active August 29, 2015 14:17
Update everything
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
}
{
_index: report_xforms_20150406_1136
_type: report_xform
_id: a54c548fa13642d3bb1127ccab053452
_score: 1
_source: {
location_: [ ]
domain: pact
xmlns: http://dev.commcarehq.org/pact/patientupdate
__retrieved_case_ids: [
<?xml version="1.0" encoding="UTF-8" ?>
<h:html xmlns:h="http://www.w3.org/1999/xhtml" xmlns:orx="http://openrosa.org/jr/xforms" xmlns="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:jr="http://openrosa.org/javarosa" xmlns:vellum="http://commcarehq.org/xforms/vellum">
<h:head>
<h:title>New Commande UX</h:title>
<model>
<instance>
<data xmlns:jrm="http://dev.commcarehq.org/jr/xforms" xmlns="http://openrosa.org/formdesigner/3c2e45b4c8d9ce9df41dfed50a1031255f5ce8b8" uiVersion="1" version="1" name="New Commande UX">
<products ids="" count="" current_index="" vellum:role="Repeat">
<item id="" index="" jr:template="">
<is_required />