Skip to content

Instantly share code, notes, and snippets.

💔
GitHub was acquired

André Staltz staltz

💔
GitHub was acquired
Block or report user

Report or block staltz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Git log graph
[alias]
lg1 = log --graph --all --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(bold white)— %an%C(reset)%C(bold yellow)%d%C(reset)' --abbrev-commit --date=relative
lg2 = log --graph --all --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(bold white)— %an%C(reset)' --abbrev-commit
lg = !"git lg1"
@staltz
staltz / _set_local_env_vars.py
Last active Feb 22, 2018
Call this from your Django settings file to import environment variables from '.env'. Useful if you use PyCharm and want an automatic solution to recognize your env variables.
View _set_local_env_vars.py
import os
ENV_VARS_FILENAME = '.env'
def import_env_vars(project_root):
"""Imports some environment variables from a special .env file in the
project root directory.
"""
if len(project_root) > 0 and project_root[-1] != '/':
@staltz
staltz / .vimrc
Last active Dec 23, 2015
vim syntax highlighting for git-done TODO
View .vimrc
" Append these to your .vimrc
syntax enable
au BufRead,BufNewFile *.todo setfiletype todo
au BufRead,BufNewFile TODO setfiletype todo
@staltz
staltz / gist:7473252
Last active Mar 6, 2018
Code glossary
View gist:7473252

Code glossary

A useful list of programming jargon to solve your naming problems.

Adapter: a design pattern that translates one interface for a class into a compatible interface.

Admin: short for 'administrator'; very commonly used in speech or online to refer to the systems person in charge on a computer. Common constructions on this include sysadmin and site admin (emphasizing the administrator's role as a site contact for email and news).

Counter: a variable or user interface that counts occurrences or repetitions of some phenomena or event.

@staltz
staltz / point-wise-err-handlers.js
Last active Aug 29, 2015
Q promises point-wise error handling
View point-wise-err-handlers.js
var Q = require('q');
function delaydo(x) {
var deferred = Q.defer();
setTimeout(function() {
if (x === 2) {
console.log("reject: "+x);
deferred.reject(x);
}
else {
@staltz
staltz / single-err-catcher.js
Created May 3, 2014
Q promises single error catcher
View single-err-catcher.js
var Q = require('q');
function delaydo(x) {
var deferred = Q.defer();
setTimeout(function() {
if (x === 2) {
console.log("reject: "+x);
deferred.reject(x);
}
else {
@staltz
staltz / promises-pyramid.js
Created May 3, 2014
Q promises pyramid of doom
View promises-pyramid.js
var Q = require('q');
function delaydo(x) {
var deferred = Q.defer();
setTimeout(function() {
if (x === 2) {
console.log("reject: "+x);
deferred.reject(x);
}
else {
@staltz
staltz / introrx.md
Last active Jul 19, 2019
The introduction to Reactive Programming you've been missing
View introrx.md
@staltz
staltz / delayUntil.xtend
Created Sep 24, 2014
.delayUntil() for RxJava
View delayUntil.xtend
/**
* Delays all items from the source Observable up until when the other Observable
* emits its first item. After the other Observable emitted its first item,
* the source items are not delayed.
*
* source: ---s-s---s----------s---s----s---s---s--|>
* other: ------------o------o-------o------o-----|>
* result: ------------sss-----s---s----s---s---s--|>
*
* @param first
@staltz
staltz / gist:2f0704b1ecadc42fb0ab
Last active Aug 29, 2015
Cycle components decouple abstraction from implementation
View gist:2f0704b1ecadc42fb0ab

Cycle custom elements decouple the component's abstraction from its implementation.

When you use a React component like

<div>
  <NewHotness />
</div>

You are pulling in that specific NewHotness component. You actually had to explicity import the NewHotness component before using it.

You can’t perform that action at this time.