Skip to content

Instantly share code, notes, and snippets.

View audreyfeldroy's full-sized avatar
💕

Audrey M. Roy Greenfeld audreyfeldroy

💕
View GitHub Profile
@jdunck
jdunck / warn_on_path_overlap.py
Created March 6, 2011 06:58
Python wart remover: avoid overlapping sys.path which results in duplicate imports.
import sys, os.path, logging
try:
import sysconfig
except ImportError:
sysconfig = None
def warn_on_path_overlap():
"""
Copyright (c) 2012, Miguel Araujo
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
@idan
idan / _more.scss
Created June 6, 2011 08:40
More is Less
$less-column-width: 68px;
$less-gutter-width: 24px;
@function column-width($columns) {
@return ($less-column-width * $columns) + ($less-gutter-width * ($columns - 1));
}
@function grid-padding-px($columns) {
@if $columns == 10 {
@return 48px;
@ojii
ojii / autobild.sh
Created September 14, 2011 04:19
autobild.sh
#!/bin/sh
#
# Copyright (c) 2011, Jonas Obrist
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
@rozza
rozza / gist:1372780
Created November 17, 2011 09:28
Encoder for MongoEngine Object
import datetime
import simplejson
from pymongo.dbref import DBRef
from pymongo.objectid import ObjectId
class MongoEngineEncoder(simplejson.JSONEncoder):
"""Handles Encoding of ObjectId's"""
@enjalot
enjalot / index.html
Created November 20, 2011 07:37
4 circles in d3.js
<!DOCTYPE html>
<html>
<head>
<title>Spiral</title>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script>
<style type="text/css">
body {
font: 10px sans-serif;
}
@hrldcpr
hrldcpr / tree.md
Last active June 8, 2024 18:11
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

@pydanny
pydanny / gist:2154218
Created March 21, 2012 23:42
Sample configparser usage
# python file
import ConfigParser
config = ConfigParser.ConfigParser()
config.read('settings.cfg')
API_KEY = config.get('Params', 'api_key')
BASE_URL = config.get("Params", 'base_url')
# settings.cfg
[Params]
@datagrok
datagrok / gist:2199506
Last active April 8, 2023 17:36
Virtualenv's `bin/activate` is Doing It Wrong
# Setup dir and repo
mkdir underscore-string
cd underscore-string
git init
# Make some files we'll need
touch README.md package.js smart.json
# Add the submodule and checkout the desired branch
git submodule add git://github.com/epeli/underscore.string.git lib/underscore.string