Skip to content

Instantly share code, notes, and snippets.

<script src="renderer.js"></script>
@ianonavy
ianonavy / wdr_top.py
Created August 9, 2012 01:33
This simple Python script shows the top contributing members of the online community, webdevRefinery. It compiles a list of members with the highest post counts and sorts them by how high their reputations are in proportion to their post counts.
#!/usr/bin/env python
""" wdR Top Contributor List
This simple Python script shows the top contributing members of the online
community, webdevRefinery. It compiles a list of members with the highest post
counts and sorts them by how high their reputations are in proportion to their
post counts.
Author: ianonavy <ian@ianonavy.com>
@Daniel15
Daniel15 / dialog.js
Created January 8, 2014 18:17
Bootstrap dialog in React
var Dialog = React.createClass({
getInitialState: function() {
return {
className: 'modal fade'
};
},
show: function() {
this.setState({ className: 'modal fade show' });
setTimeout(function() {
this.setState({ className: 'modal fade show in' });
@corywheeler
corywheeler / mocha-before-and-beforeEach-lifecycles.js
Created December 12, 2014 17:14
Show the order of execution of mocha's before and beforeEach hooks for each describe and each test
describe('highest level describe', function () {
before(function() {
console.log('This is the highest level before')
})
beforeEach(function() {
console.log('This is the highest level beforeEach')
})
it('This is the first highest level test', function() {
@jcpst
jcpst / mh.zsh-theme
Created August 19, 2015 17:31
Oh My ZSH prompt with git/node/docker-machine awareness
# mh theme
# Modified by Joseph Post
# features:
# path is autoshortened to ~25 characters
# displays git status, short SHA, and clean/dirty
# displays node/npm versions
# displays docker machine name if active.
# prompt
@mauvm
mauvm / gist:5de07085f3b51e117378
Created July 26, 2015 11:57
An "envsubst" alternative for replacing env variables in NGinX site configurations (for using it with Docker)
#!/bin/bash
# NOTE: Brackets are not supported and '$' in values will break the script.
mkdir /etc/nginx/sites-enabled 2> /dev/null
for file in /etc/nginx/sites-available/*.conf
do
TPL=$(cat $file)
for row in $(env)
do
#ifndef BIQUAD_H
#define BIQUAD_H
#include <math.h>
#include <stdint.h>
#ifndef M_PI
# define M_PI 3.14159265358979323846
#endif
@shuxiang
shuxiang / sqla.py
Last active September 7, 2022 10:34
sqlalchemy get model by name and get model by tablename
from flask.ext.sqlalchemy import SQLAlchemy
def get_model(self, name):
return self.Model._decl_class_registry.get(name, None)
SQLAlchemy.get_model = get_model
def get_model_by_tablename(self, tablename):
for c in self.Model._decl_class_registry.values():
if hasattr(c, '__tablename__') and c.__tablename__ == tablename:
return c
@m1
m1 / ferengi-apache.txt
Last active September 15, 2023 07:33
How to throttle the FCC to dial up modem speeds on your website using Apache.
# How to throttle the FCC to dial up modem speeds on your website using Apache.
# Ported from https://gist.github.com/kyledrake/e6046644115f185f7af0
## The blog post that started it all: https://neocities.org/blog/the-fcc-is-now-rate-limited
##
## Current known FCC address ranges:
## https://news.ycombinator.com/item?id=7716915
##
## Confirm/locate FCC IP ranges with this: http://whois.arin.net/rest/net/NET-165-135-0-0-1/pft
@rauchg
rauchg / README.md
Last active January 6, 2024 07:19
require-from-twitter