Skip to content

Instantly share code, notes, and snippets.

@dansimau
dansimau / README.md
Created July 13, 2012 10:39
Enable git-style colour output in regular diff on Mac OS X

Enable git-style colour output in regular diff

Mac OS X

  1. Install colordiff using Homebrew:

     brew install colordiff
    
  2. Add function to your ~/.bash_profile:

@teamon
teamon / prof.rb
Created June 5, 2013 14:56
Profile rails controller with ruby-prof
# gem "ruby-prof"
around_filter :profiler
def profiler(&block)
data = RubyProf::Profile.profile(&block)
filepath = Rails.root.join("tmp", "profiler.html")
File.open(filepath, "w") do |f|
RubyProf::CallStackPrinter.new(data).print(f)
@kosamari
kosamari / _.R.js
Last active December 7, 2018 11:12
Underscore mixin to enable core R functions
_.mixin({
sum : function(data){
return _.reduce(data, function(memo, num){ return memo + num; }, 0);
},
mean : function(data){
return this.sum(data)/data.length
},
median : function(data){
return this.percentile(data,50);
},
@maartenzam
maartenzam / README.md
Last active October 27, 2015 15:19
Fly over latitude parallel

My first experiment with Mapbox GL is a mock up of what astronauts in the ISS could see out of their window.

This map let's you fly over the latitude parallel of your choice. You can change

  • the baselayer (hybrid, streest of satellite)
  • the parallel you are flying over (pan left or right)
  • the zoom (+ and - in upper right corner)
  • rotation of view (the compass in the upper right corner)
@kylemcdonald
kylemcdonald / Fast Probability Distribution Generation.ipynb
Created March 30, 2016 16:10
Fast generation of random numbers given a probability distribution.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.