Skip to content

Instantly share code, notes, and snippets.

View atdt's full-sized avatar
💭
I may be slow to respond.

Ori Livneh atdt

💭
I may be slow to respond.
  • Google
  • New York City
View GitHub Profile
@devn
devn / Destructuring Examples.clj
Created June 15, 2010 09:27
Destructuring Examples
;;; All Kinds of Destructuring ;;;
(let [foo 1] foo)
; => 1
(let [[foo bar] [1 2 3]] [foo bar])
; => [1 2]
(let [[foo bar & baz] [1 2 3]] [foo bar baz])
; => [1 2 (3)]
"""
jQuery templates use constructs like:
{{if condition}} print something{{/if}}
This, of course, completely screws up Django templates,
because Django thinks {{ and }} mean something.
Wrap {% verbatim %} and {% endverbatim %} around those
blocks of jQuery templates and this will try its best
@MicahElliott
MicahElliott / colortrans.py
Created November 29, 2010 07:57
Convert values between RGB hex codes and xterm-256 color codes.
#! /usr/bin/env python
""" Convert values between RGB hex codes and xterm-256 color codes.
Nice long listing of all 256 colors and their codes. Useful for
developing console color themes, or even script output schemes.
Resources:
* http://en.wikipedia.org/wiki/8-bit_color
* http://en.wikipedia.org/wiki/ANSI_escape_code
@dbrgn
dbrgn / queryset_generators.py
Created April 1, 2011 08:41
queryset_generator and queryset_list_generator
def queryset_generator(queryset, chunksize=1000):
"""
Iterate over a Django Queryset ordered by the primary key
This method loads a maximum of chunksize (default: 1000) rows in its
memory at the same time while django normally would load all rows in its
memory. Using the iterator() method only causes it to not preload all the
classes.
Note that the implementation of the generator does not support ordered query sets.
@dtjm
dtjm / cramfs-osx.diff
Created September 9, 2011 20:52
cramfs patch for OS X
--- cramfs-1.1/cramfsck.c 2011-09-09 13:39:01.000000000 -0700
+++ cramfs-dtjm/cramfsck.c 2011-09-09 13:39:02.000000000 -0700
@@ -47,14 +47,17 @@
#include <stdlib.h>
#include <errno.h>
#include <string.h>
-#include <sys/sysmacros.h>
#include <utime.h>
#include <sys/ioctl.h>
#define _LINUX_STRING_H_
@mmalecki
mmalecki / ansispan.js
Created November 27, 2011 19:20
My finite state machine for parsing ANSI codes
var ansispan = function (str) {
}
ansispan.parse = function (str) {
//
// I'm terrible at writing parsers.
//
var matchingControl = null,
matchingData = null,
matchingText = null,
@paulirish
paulirish / moved.md
Last active October 1, 2015 01:38 — forked from dmethvin/gist:1676346
Breakpoint on access to a property
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active June 5, 2024 22:16
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@nticaric
nticaric / BoyerMoore.php
Last active July 16, 2022 08:25
Boyer–Moore algorithm implementation in PHP
<?php
/**
* Returns the index of the first occurrence of the
* specified substring. If it's not found return -1.
*
* @param text The string to be scanned
* @param pattern The target string to search
* @return The start index of the substring
*/
@pascalpoitras
pascalpoitras / config.md
Last active June 6, 2024 13:09
My WeeChat configuration

WeeChat Screenshot

Mouse


enable