Skip to content

Instantly share code, notes, and snippets.

@tcg
tcg / pointingpoker-mindreader.css
Created February 19, 2014 20:42
Read minds while using http://pointingpoker.com/ Also includes some bonus tips/material.
/**
* Add this style to the page. It's like you can read minds.
* Ugly, but it works. It's a free example, alright!?
*/
.playerPoints::after {
content: attr(data-point-value);
font-style: italic;
font-weight: bolder;
background-color: #eee;
padding-left: 1em;
/* Solarized Dark
For use with Jekyll and Pygments
http://ethanschoonover.com/solarized
SOLARIZED HEX ROLE
--------- -------- ------------------------------------------
base03 #002b36 background
base01 #586e75 comments / secondary content
# -*- coding: utf-8 -*-
from datetime import datetime
import time
import sublime_plugin
class TimestampCommand(sublime_plugin.EventListener):
"""Expand `isoD`, `now`, `datetime`, `utcnow`, `utcdatetime`,
`date` and `time`
@tcg
tcg / gist:3177488
Created July 25, 2012 17:47
List available Basecamp chat commands.
// While chatting it up in Basecamp, use this in a javascript console to see the
// list of available chat commands you can use with `/play`.
for (key in window.chat.sounds) { console.log(key); }
@tcg
tcg / gist:63af244d01f1aae1810a
Created October 20, 2015 19:04 — forked from Ry4an/gist:8736298
Detecting referenced unset variables. based on https://excess.org/article/2012/04/paranoid-django-templates/
class ParanoidContextProxy(object):
"""
This is a poor-man's proxy for a context instance.
Make sure template rendering stops immediately on a KeyError.
"""
def __init__(self, context):
self.context = context
def __getitem__(self, key):
@tcg
tcg / .profile
Last active November 19, 2015 07:17
Some current aliases and functions from my .profile/.bashrc/.zshrc, etc
# List Git branches in order of most-recently-updated.
# https://gist.github.com/tcg/381dba155117a2e7a545
alias gitbranchesbydate="git for-each-ref --sort=-committerdate refs/heads/ --format='%(committerdate:iso8601) %09 %(refname) %09 %(authorname)' | sed -e 's-refs/heads/--'"
# Output looks like:
# 2014-06-06 12:58:53 -0500 tcg/donate_language_updates Tommy George
# 2014-06-06 10:28:04 -0500 integration Brad
# 2014-06-05 16:13:30 -0500 super_dev_branch Chris
# List files that SHOULD now be ignored by .gitignore, but might not yet be.
# Use this if you just added your .gitignore file and want to make sure that
@tcg
tcg / view_readline_history.py
Created December 20, 2012 18:44
View readline history of Python interactive shell
import readline
for i in range(readline.get_current_history_length()):
print readline.get_history_item(i)
@tcg
tcg / comfort_sweet.py
Last active December 11, 2015 20:09
Something Sweet to Comfort some folks that are tired of checking the box. Bloated requirements, but it works. Want to skip Requests and use something more native? DO IT! Updated! Now: More bloat! But less rude, and works FASTER! YAY!
import requests # `pip install requests`; DO IT!
import time
import sys
class ComfortSweet:
TIME_THRESHOLD = 30 # seconds
LAST_ATTEMPT = 0

Awesome PHP Libraries

A list of amazingly awesome PHP libraries that you should consider using (and some other shiny extras).

@tcg
tcg / guessing_game.py
Created April 25, 2016 15:26
Some Python code to tinker with the ideas presented in the Numberphile episode "How to Win a Guessing Game".
"""
Some Python code to tinker with the ideas presented
in the Numberphile episode "How to Win a Guessing Game".
See: https://www.youtube.com/watch?v=ud_frfkt1t0
"""
import random
import time