Skip to content

Instantly share code, notes, and snippets.

View michaelfairley's full-sized avatar

Michael Fairley michaelfairley

View GitHub Profile
Play this game by pasting the script in http://www.puzzlescript.net/editor.html
use std::mem;
use std::ptr;
fn spooky(_data: &[f32; 3]) {
// This function does nothing. Calling it should have no effect on the program.
}
pub fn main() {
let data1 = [1.0, 2.0, 3.0];
let data2 = [1.0, 2.0, 3.0];
@michaelfairley
michaelfairley / gist:8343008
Created January 9, 2014 22:09
Pipe curl into bash it'll be fine I promise
$ curl -Ss "https://www.howsmyssl.com/a/check" | jsonpp
{
"given_cipher_suites": [
"TLS_DHE_RSA_WITH_AES_256_CBC_SHA",
"TLS_DHE_DSS_WITH_AES_256_CBC_SHA",
"TLS_RSA_WITH_AES_256_CBC_SHA",
"TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA",
"TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA",
"TLS_RSA_WITH_3DES_EDE_CBC_SHA",
"TLS_DHE_RSA_WITH_AES_128_CBC_SHA",
$ curl -v https://rubygems.global.ssl.fastly.net/
* About to connect() to rubygems.global.ssl.fastly.net port 443 (#0)
* Trying 199.27.73.185...
* Connection refused
* couldn't connect to host
* Closing connection #0
curl: (7) couldn't connect to host
$ curl -v http://rubygems.global.ssl.fastly.net/
* About to connect() to rubygems.global.ssl.fastly.net port 80 (#0)
@michaelfairley
michaelfairley / stuff.md
Last active June 11, 2017 21:02
Makin' Games with Ruby
@michaelfairley
michaelfairley / mri
Created July 24, 2013 20:45
rbx open_timeout woes
$ ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.4.2]
$ time ruby open_timeout.rb
/Users/michaelfairley/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/net/http.rb:762:in `initialize': execution expired (Timeout::Error)
from /Users/michaelfairley/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/net/http.rb:762:in `open'
from /Users/michaelfairley/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/net/http.rb:762:in `block in connect'
from /Users/michaelfairley/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/net/http.rb:762:in `connect'
from /Users/michaelfairley/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/net/http.rb:755:in `do_start'
from /Users/michaelfairley/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/net/http.rb:744:in `start'
from /Users/michaelfairley/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/net/http.rb:1284:in `request'
@michaelfairley
michaelfairley / bowling.erl
Last active December 20, 2015 03:29
Erlang bowling kata
-module(bowling).
-export([main/1]).
main(_) ->
test().
test() ->
% empty
[] = score([]),
% boring
@michaelfairley
michaelfairley / Gemfile
Created July 22, 2013 00:01
Mutant 0.3.0.beta17 regexp literal with interpretation woes
source "https://rubygems.org"
gem 'mutant', '0.3.0.beta17'
gem 'rspec', '2.14.1'
@michaelfairley
michaelfairley / immutable-ruby.md
Last active October 8, 2019 14:15
Immutable Ruby

Immutable Ruby

Libraries I talked about

  • ice_nine: Deep freeze ruby objects
  • Values: Simple immutable value objects for ruby
  • immutable_attributes: specify attributes within an ActiveRecord model that can be set but not modified
  • hamster: Efficient, Immutable, Thread-Safe Collection classes for Ruby

Next Steps

class A
def self.set
@x = "hello"
end
def self.get
@x || "byebye"
end
end