Skip to content

Instantly share code, notes, and snippets.

@Thinkscape
Thinkscape / tooltipGroup.js
Last active August 29, 2015 13:56
tooltip-group support for angular-strap
module.directive('tooltipGroup', [
var popoverRegistry = {};
var suspend = false; // semaphore used to prevent circular calling of hide triggers
function(){
return {
restrict : 'A',
priority : 1,
link : {
pre : function ($scope, el, attrs, formCtrl) {
// $scope.artifactPickerSelectOptions = artifactPicker.getSelectOptions();
@patcoll
patcoll / twig.php
Created March 2, 2010 15:53
Command-line script to process YAML frontmatter with Twig templates.
<?php
/**
* twig.php
*
* Command-line script to process YAML frontmatter with Twig templates.
* Inspired by Mustache <http://github.com/defunkt/mustache>.
*
* Example template file (test.html):
* ---
* people: [ {name: scott}, {name: laura} ]
@kennethreitz
kennethreitz / memcache-dv.sh
Created April 22, 2010 05:55
Install memcache on a MediaTemple (dv)
wget http://dag.wieers.com/rpm/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
rpm --install rpmforge-release-0.3.6-1.el5.rf.i386.rpm
yum install --enablerepo=rpmforge memcached
memcached -d -m 512 -l 127.0.0.1 -p 11211 -u nobody
wget http://pecl.php.net/get/memcache-2.2.5.tgz
tar -xvf memcache-2.2.5.tgz
cd memcache-2.2.5
phpize && ./configure --enable-memcache && make
cp /root/memcache-2.2.5/modules/memcache.so /usr/lib/php/modules/
echo extension=memcache.so >> /etc/php.ini
@hdragomir
hdragomir / $.fn.redraw.js
Created December 14, 2010 09:45
Quick jQuery plugin to force element redraws
(function($){
$.fn.redraw = function(){
return $(this).each(function(){
var n = document.createTextNode(' ');
$(this).append(n);
setTimeout(function(){n.parentNode.removeChild(n)}, 0);
});
}
})(jQuery)
@insin
insin / gist:1031662
Created June 17, 2011 15:38
Boilerplate for serving a regular old HTML table as application/vnd.ms-excel, apropos acheiving Excel surround sound
<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="expires" content="Mon, 06 Jan 1999 00:00:01 GMT">
<meta http-equiv=Content-Type content="text/html; charset=UTF-8">
<!--[if gte mso 9]><xml>
<x:ExcelWorkbook>
<x:ExcelWorksheets>
<x:ExcelWorksheet>
---
layout: post
title: This is my post title
---
{% block content %}
# {{title}}
This is the long version of my content. Blah blah blah.
@fawce
fawce / generic_algo.py
Created January 8, 2012 14:15
Simple Object Model for Quantopian Algorithm
class SecurityState():
"""An example class to track persistent state for a
specific security. This trivial example just tracks the max
price for the security, as well as shares ordered.
Modify this class to track individual securities."""
def __init__(self, tick):
self.sid = tick.sid
self.max_price = tick.price
@ianb
ianb / git-sync.sh
Created January 31, 2012 06:34
An attempt at a simple sync command for git
#!/usr/bin/env bash
set -e
if [ "$1" = "-h" ] || [ "$1" = "--help" ] ; then
echo "usage: git sync [remote-name]"
echo
echo "Sync's the current repository to another remote host, using git,"
echo "but not using this repository."
echo
@Goutte
Goutte / DumpyTwigFilter.php
Created February 5, 2012 18:25
Designer-friendly dump as YAML Twig Extension Filter
<?php
/**
* Extends Twig with
* {{ "my string, whatever" | pre }} --> wraps with <pre>
* {{ myBigVar | yaml_dump | pre }} as {{ myBigVar | ydump }} or {{ myBigVar | dumpy }}
* {{ myBigVar | var_dump | pre }} as {{ myBigVar | dump }}
*
* You may control the depth of recursion with a parameter, say foo = array('a'=>array('b'=>array('c','d')))
*
@samchandra
samchandra / gist:2004171
Created March 8, 2012 23:40
Twitter Timeline and Facebook Pages Feed Aggregator with Ruby
require 'rubygems'
require 'bundler/setup'
require 'time'
require 'date'
require 'twitter'
require 'fb_graph'
require 'pp'
require 'json'
# Twitter