Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View sloria's full-sized avatar

Steven Loria sloria

View GitHub Profile
@jmcarp
jmcarp / pagination.py
Last active August 29, 2015 14:11
pagination
import abc
import math
import collections
import six
@six.add_metaclass(abc.ABCMeta)
class Paginator(object):
@barneycarroll
barneycarroll / class.es5.js
Last active August 29, 2015 14:17
ES6 classes in ES5.
var slice = Array.prototype.slice;
function Class( Super, Schema ){
if( arguments.length < 2 ){
Schema = Super;
Super = Object;
}
var constructor = Schema.constructor ? Super ? function SubClass(){
var args = slice.call( arguments );
@gilbert
gilbert / component-sugar.js
Last active August 29, 2015 14:17
Mithril Component Sugar
m.callableComponent = function (componentObj) {
var componentFn = function (props, content) {
return m.component(componentFn, props, content)
}
if (componentObj) {
for (var prop in componentObj) {
componentFn[prop] = componentObj
}
}
return componentFn
@fabianvf
fabianvf / pip requirements
Last active February 1, 2017 11:37
ansible pip install lxml
- name: Install lxml requirements
apt: "pkg={{ item }} state=present update_cache=yes"
sudo: yes
with_items:
- python-dev
- libxml2
- libxml2-dev
- libxslt1-dev
- lib32z1-dev
- libssl-dev
@jmcarp
jmcarp / marshmodel.py
Last active March 5, 2018 01:45
marshmallow-models
import six
import inflection
import marshmallow as ma
class Model(object):
def __init__(self, **kwargs):
self._schema = self.Schema()
self.load(**kwargs)
var MyComponent = Factory({
willMount: function(element, context) {
console.log('component mounted', element.tagName);
};
willUnmount: function(element, context) {
console.log('component unmount', element.tagName);
};
view: function() {
anonymous
anonymous / dontforget.sh
Created August 5, 2016 11:06
Quick reminders from Terminal (bash) - Linux version
#!/usr/bin/env bash
# dontforget
# Description: A stupid script for short term reminders in bash
# Requires: espeak, mpg123, notify-send, ogg123 (vorbis-tools)
# Source: http://brettterpstra.com/2016/01/22/quick-reminders-from-terminal
# Usage:
#
# Arguments just need to contain a number and a bunch of words.
#
# The number can be anywhere in the arguments, but there shouldn't
import sys
from django.conf import settings
settings.configure(
DEBUG=True,
SECRET_KEY='thisisthesecretkey',
ROOT_URLCONF=__name__,
MIDDLEWARE_CLASSES=(
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
@bhauman
bhauman / README.md
Last active December 3, 2019 16:43
ClojureScript minimal dev and prod setup.

Recent improvements to the ClojureScript compiler have greatly simplified setting up development versus production outputs.

This example uses Figwheel as something that you want to exclude for production, but the pattern is general.

With this simple setup you only need one html file/view and it will work for developement and production.