Skip to content

Instantly share code, notes, and snippets.

View jdfreder's full-sized avatar

Jonathan Frederic jdfreder

View GitHub Profile
@jdfreder
jdfreder / wslog.js
Last active May 20, 2016 22:13
Log websocket messages
// Dump this into your web console in a live notebook
function safeLog(type) {
try {
console.log.apply(console, arguments);
} catch(err) {
console.warn(type, 'could not print data');
}
}
var orig1 = Jupyter.notebook.kernel.ws.onmessage;
Jupyter.notebook.kernel.ws.onmessage = function() {
@jdfreder
jdfreder / .bashrc
Last active January 5, 2016 00:46
*nix and win aliases
alias push="git push"
alias pull="git pull"
alias reb="git rebase"
alias com="git commit"
alias co="git checkout"
alias merge="git mergetool"
alias st="git status"
alias br="git branch"
alias add="git add"
alias grm="git rm"
@fperez
fperez / ipython-0.0.1.py
Created January 8, 2012 21:05
IPython 0.0.1, a simple script to be loaded as $PYTHONSTARTUP: of historical interest only...
#!/usr/bin/env python
"""
Interactive execution with automatic history, tries to mimic Mathematica's
prompt system. This environment's main features are:
- Numbered prompts (In/Out) similar to Mathematica. Only actions that produce
output (NOT assingments, for example) affect the counter and cache.
- The following GLOBAL variables always exist (so don't overwrite them!):
_p: stores previous result which generated printable output.
@Gozala
Gozala / extend-array.js
Created November 7, 2010 17:10
Array subclass ES5
// No need to sub class Array if what you need is just an extended
// array. Example below illustrates the way to extend Array.
function SubArray() {
return Object.defineProperties(Array.prototype.slice.call(arguments), SubArrayDescriptor)
}
SubArray.prototype = Array.prototype
var SubArrayDescriptor =
{ constructor: { value: SubArray }
, last: { value: function last() {