Skip to content

Instantly share code, notes, and snippets.

View NewAlexandria's full-sized avatar
🍄
My responses are limited; you must ask the right questions.

NewAlexandria

🍄
My responses are limited; you must ask the right questions.
View GitHub Profile
// Processing motion blur
// 'time' runs from 0 to 1
// ignore everything above the /////////
// by Dave @ beesandbombs
int[][] result;
float time;
void setup() {
setup_();
@NewAlexandria
NewAlexandria / lucidchart.js
Created November 26, 2014 15:16
The unminified source of Lucidcharts, as of 2014-11-26
This file has been truncated, but you can view the full file.
(function() {
var h, ba = ba || {},
ca = this;
function da(a) {
return void 0 !== a
}
function ha(a) {
@NewAlexandria
NewAlexandria / letter permutation
Created April 9, 2015 13:30
Outputs string combinatorics
r = ('a'..'z')
r.map{|l| r.map{|w| r.map{|q| q+w+l} } }.flatten
r.map{|l| r.map{|w| r.map{|q| r.map{|t| q+w+l+t } }} }.flatten.size
# add exclusions
# add recursion
@NewAlexandria
NewAlexandria / recent_papers_we_love.js
Created June 8, 2015 04:39
A list of the 10 most-recent submissions to papers we love
if (!window.jQuery) { document.write('<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"><\/script>') };
var recent_papers = [];
var commits = {};
var base_commit = '';
while (recent_papers.length < 10) {
commits_url = "https://api.github.com/repos/papers-we-love/papers-we-love/commits?sha="+base_commit;
$.ajax({
url: commits_url,
success: function(data) {
$(data).each( function(idx) {
File.open(".vimrc","a") do |f|
f.write File.readlines('.gitmodules')
.map(&:strip)
# remove extras
.reject do |l|
l.scan('[').any? || # submodule defs
l.scan(/^path/).any? || # submodules paths
l.empty? # blank lines
end
# remap URLs to user/repo names
@NewAlexandria
NewAlexandria / rub_bigdec_float.rb
Created January 13, 2012 17:03
Ruby comparison of BigDecimal vs. Float
# I've compiled this in order to test the speed on using a BidDecimal, which some in the community assert is slower than using a float.
# So far, it looks like BigDecimal is faster, and I've created this file to solicit feedback. Cheers.
run_size = 10000
p_fin = []
p_fin << "Each run #{run_size}"
t1 = Time.now
run_size.times do
r = BigDecimal.new
@NewAlexandria
NewAlexandria / rbenv_ree_install.sh
Created February 13, 2012 21:11
Installing Ruby Enterprise Edition into rbenv
########
# This file script wil show you how to install Ruby Enterprise Edition (REE) 1.8.7-2011-12 with
# rbenv, rails 3 and homebrew. Bundler is also used.
########
#setup the installer environment
brew install wget
wget -q http://rubyenterpriseedition.googlecode.com/files/ruby-enterprise-1.8.7-2011.12.tar.gz
tar xzf ruby-enterprise-1.8.7-2011.12.tar.gz
@NewAlexandria
NewAlexandria / gemset_marhsalling.md
Created June 7, 2012 20:13
Marshaling Gemsets for Enterprise Gem Control

Problem Case

The situation arose where our Certifier gem would not bundle install Could not find gem 'rspec-core (= 2.5.1, runtime)' in any of the gem sources listed in your Gemfile.

Our gemserver (non-rubygems) only had

  • rspec-core-2.6.4.gem
  • rspec-core-2.8.0.gem

Analysis: someone had an old gem installed via rubygems, and didn't run bundle update when building the latest certifier. This used to be solved by maintaining the full-history of dependencies on our gemserver.

@NewAlexandria
NewAlexandria / DNA.md
Created November 28, 2012 20:14
Emoji art test

〰️ 〰️ 〰️ 〰️ 🔱 〰️ 〰️ 〰️ 〰️

〰️ 〰️ 〰️ 🔥 🌀 🍃 〰️ 〰️ 〰️

〰️ 〰️ 🔥 〰️ ☁️ 〰️ 🍃 〰️ 〰️

〰️ 〰️ 🔥 〰️ ⚡ 〰️ 🍃 〰️ 〰️

〰️ 〰️ 〰️ 🔥 🎶 🍃 〰️ 〰️ 〰️

@NewAlexandria
NewAlexandria / brew_inventory.rb
Created October 19, 2015 04:28
A quickie copypasta for getting your main brew packages
#!/usr/bin/env ruby
bl = `brew list`.split ;1
bdl = bl.reduce({}) {|h, pkg| h.merge({pkg => `brew deps #{pkg}`.split }) } ;1
bi = bl - bdl.values.flatten.sort
File.open('apps_brew.txt', 'w') {|f| f.write bi.join("\n") }