Skip to content

Instantly share code, notes, and snippets.

@rm-hull
rm-hull / PARAMETRIC-EQUATIONS.md
Last active August 29, 2015 13:55
An animated render of a parametric equation in ClojureScript with big-bang. A curve is swept out where the trajectory of a point is usually represented by a parametric equation with the time as parameter.

Parametric Equations

Using:

x

y

Where t increases monotonically, and k can be varied with the slider below, the (x,y) co-ordinates sweep out the curve of a distressed Cardioid. When k = 0.5 the curve sweeps out a perfect Cardioid.

def pmap(enum)
return to_enum(:pmap, enum) unless block_given?
enum.map { |e| Thread.new { yield e } }.map(&:value)
end
# Returns elements in order, as expected.
pmap(1..10) { |e| e } #=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
# Returns elements in nondeterministic order on MRI >= 1.9.3.
# Works as expected on JRuby, Rubinius, and earlier versions of MRI.
@christoomey
christoomey / vim-bostonrb-talk-notes.md
Last active August 29, 2015 13:57
Talk notes from my Vim for Ruby and Rails talk at BostonRb's March 2014 meetup
@jacklynrose
jacklynrose / RubyMotionTheRailsWay.md
Last active August 29, 2015 13:57
Ideas on how to write RubyMotion apps the "Rails" way

RubyMotion The "Rails" Way

This is a current proposal that I'd like your feedback on for how we can clean up how we write RubyMotion applications. It's purely conceptual at the moment, and there would have to be some framework development to make this work the way described here.

Please submit your feedback, as a joint effort we can clean up our RubyMotion applications and make it easier for Rails developers to expand their skills into RubyMotion development.

Goals

The main points of this are:

@baweaver
baweaver / prime_perms2.rb
Last active August 29, 2015 14:03
Variant of Prime Perms, checking mersennes from 1 to 1 million, using block extraction for time comparisons. Surprising results were found when t3 dominated the field.
# From original: https://gist.github.com/baweaver/11163861
# Using Pipeable for clearer code: https://github.com/baweaver/pipeable
# and Benchpress to measure: https://github.com/baweaver/benchpress
# Make Object Pipeable
class Object; include Pipeable end
# Patch numbers to have a prime? method
class Fixnum
def prime?
@iHiD
iHiD / instructions
Last active August 29, 2015 14:04 — forked from agraves/instructions
Instructions for clearing expired DigiCert SSL certificate on OSX by [https://gist.github.com/agraves](agraves)
NOTICE: The following instructions "worked for me." Proceed at your own risk.
Symptoms:
* Visiting several sites, such as github, gravatar, twitter's CDN results in "invalid certificate" errors
* For example: http://i.imgur.com/8gPRfI3.png
Instructions
@searls
searls / layout.html.erb
Created August 27, 2014 18:50
Delay implementing a PDF rendering feature by beating Chrome into submission instead
<%= stylesheet_link_tag "application", :media => "screen,print" %>
@seejohnrun
seejohnrun / tap_try.rb
Last active August 29, 2015 14:05
tap_try should exist
# Mark NoMethodError(s) coming from a call on `nil`
class NilClass
def method_missing(*)
super
rescue NoMethodError => e
e.instance_variable_set :@real_nil, true
raise e
end
end
@avdi
avdi / unindent.rb
Created September 16, 2014 19:00
Stripping indentation from heredocs
TEXT = <<EOF
See, the interesting thing about this text
is that while it seems like the first line defines an indent
it's actually the last line which has the smallest indent
there are also some blank lines
both with and without extra spaces in them
and it just goes on and on
@ccare
ccare / checker
Last active August 29, 2015 14:06
Hunt for suspicious env-vars possibly relating to ShellShock <http://seclists.org/oss-sec/2014/q3/650>
#!/bin/dash
for pid in `ps -Ao pid | grep -v PID`; do xargs -n 1 -0 <"/proc/$pid/environ" | grep -e '=()'; done