Skip to content

Instantly share code, notes, and snippets.

View chriddyp's full-sized avatar

Chris Parmer chriddyp

View GitHub Profile
# coding=utf-8
"""
LICENSE http://www.apache.org/licenses/LICENSE-2.0
"""
import datetime
import sys
import time
import threading
import traceback
import SocketServer
@ondrek
ondrek / gist:7413434
Created November 11, 2013 13:48
Smallest Base64 image
data:image/gif;base64,R0lGODlhAQABAAAAACw=
@zoul
zoul / build-notifier.rb
Last active May 17, 2018 15:21
Posts a message to the OS X notification center when a Jekyll build is finished. Requires TerminalNotifier, see http://git.io/5X99Eg or “gem install terminal-notifier”.
begin
require 'terminal-notifier'
module Jekyll
class Site
alias jekyll_process process
def process
jekyll_process
TerminalNotifier.notify('Jekyll rebuild finished.')
end
end
@msund
msund / Plots!
Last active October 10, 2019 23:10
Data Science Demo
{
"metadata": {
"name": "Reproducible figures"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
// Restify Server CheatSheet.
// More about the API: http://mcavage.me/node-restify/#server-api
// Install restify with npm install restify
// 1.1. Creating a Server.
// http://mcavage.me/node-restify/#Creating-a-Server
var restify = require('restify');
@ihuston
ihuston / Flask on CF.md
Last active February 11, 2023 19:16
Simple Flask application for Cloud Foundry

Simple Python Flask app on Cloud Foundry

This is a (very) simple Flask application that shows how the built-in Python buildpack detection on Cloud Foundry works.

To push to Cloud Foundry, log in and then use

$ cf push myapp-name

Python on Cloud Foundry

@jhartikainen
jhartikainen / commit-msg
Created February 6, 2015 17:46
ESLint git commit hook
#!/bin/bash
files=$(git diff --cached --name-only | grep '\.js$')
# Prevent ESLint help message if no files matched
if [[ $files = "" ]] ; then
exit 0
fi
echo $files | xargs eslint
@twolfson
twolfson / README.md
Created February 23, 2015 22:45
Python unittest `setUp` inheritance

In some cases for Python unit tests, we want to automatically perform setUp methods in as declared in a base class. However, we still want setUp to work as per normal in the subclass. The following code will proxy the new setUp function to run it's base class' and the new one.

# Define a common test base for starting servers
class MyBaseTestCase(unittest.TestCase):
    @classmethod
    def setUpClass(cls):
        """On inherited classes, run our `setUp` method"""
        # Inspired via http://stackoverflow.com/questions/1323455/python-unit-test-with-base-and-sub-class/17696807#17696807
        if cls is not MyBaseTestCase and cls.setUp is not MyBaseTestCase.setUp:
@Couto
Couto / webpack.js
Last active November 11, 2020 17:53
Fetch polyfill with webpack
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var path = require('path');
var folders = {
APP: path.resolve(__dirname, '../app'),
BUILD: path.resolve(__dirname, '../build'),
BOWER: path.resolve(__dirname, '../bower_components'),
NPM: path.resolve(__dirname, '../node_modules')
};
@cpsievert
cpsievert / plotly-docs.R
Last active August 20, 2018 15:04
Plotly examples
# install the new/experimental plotly R package
# devtools::install_github("ropensci/plotly@carson-dsl")
# ----------------------------------------------------------------------
# https://plot.ly/r/3d-line-plots/
# ----------------------------------------------------------------------
library(plotly)
# initiate a 100 x 3 matrix filled with zeros