Skip to content

Instantly share code, notes, and snippets.

@lsegal
lsegal / config.ru
Last active August 29, 2015 13:58 — forked from anonymous/config.ru
require_relative 'boot'
db = Sequel.connect(ENV['DATABASE_URL'])
Urls.attach_db(db[:urls])
run UrlShortener
$ grep -r ':nodoc:' .
Binary file ./.git/objects/pack/pack-c68551034ab92084bc1c3bf0bbca075bcd59b599.pack matches
./actionmailer/lib/action_mailer/base.rb: def _protected_ivars # :nodoc:
./actionmailer/lib/action_mailer/base.rb: private_class_method :new #:nodoc:
./actionmailer/lib/action_mailer/base.rb: def deliver_mail(mail) #:nodoc:
./actionmailer/lib/action_mailer/base.rb: def respond_to?(method, include_private = false) #:nodoc:
./actionmailer/lib/action_mailer/base.rb: def set_payload_for_mail(payload, mail) #:nodoc:
./actionmailer/lib/action_mailer/base.rb: def method_missing(method_name, *args) # :nodoc:
./actionmailer/lib/action_mailer/base.rb: def process(method_name, *args) #:nodoc:
./actionmailer/lib/action_mailer/base.rb: class NullMail #:nodoc:
@lsegal
lsegal / setup.js
Created March 19, 2014 18:23
Bug in ESLint checking of .eslintrc files in subdirectories. Run 'node setup.js' then 'eslint lib'
var fs = require('fs');
fs.mkdirSync('lib');
fs.mkdirSync('lib/foo');
// turn off camelcase check for .eslintrc
fs.writeFileSync('.eslintrc', '{ "rules": { "camelcase": 0 } }');
// this file should not raise error, not inside of lib/foo/*
fs.writeFileSync('lib/foo.js', 'var not_camelcase = 0;');
@lsegal
lsegal / test-with-q.js
Created March 7, 2014 20:59
Uses promises with the AWS SDK for JavaScript
var AWS = require('aws-sdk');
var s3 = new AWS.S3();
var Q = require('q');
var list = Q.nbind(s3.listBuckets.bind(s3));
list().then(function(data) {
console.log(data);
});
// AWS SDK for JavaScript v2.0.0-rc8
// Copyright 2012-2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// License at https://sdk.amazonaws.com/js/BUNDLE_LICENSE.txt
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
},{}],2:[function(require,module,exports){
var Buffer = require('buffer').Buffer;
var intSize = 4;
var zeroBuffer = new Buffer(intSize); zeroBuffer.fill(0);
var chrsz = 8;
$ ROLE=$(curl http://169.254.169.254/latest/meta-data/iam/security-credentials/)
$ curl http://169.254.169.254/latest/meta-data/iam/security-credentials/$ROLE
@lsegal
lsegal / favourite_papers.md
Created November 8, 2013 18:39
Some of my favourite research papers in formal methods & static analysis
source 'https://rubygems.org'
gem 'rspec', git: 'git://github.com/rspec/rspec'
gem 'rspec-core', git: 'git://github.com/rspec/rspec-core'
gem 'rspec-mocks', git: 'git://github.com/rspec/rspec-mocks'
gem 'rspec-expectations', git: 'git://github.com/rspec/rspec-expectations'
@lsegal
lsegal / aws-repl.rb
Last active December 6, 2018 16:59 — forked from mdub/aws-repl.rb
#!/usr/bin/env ruby
require 'aws-sdk'
require 'pry'
Pry.config.prompt = [proc { "AWS> " }, proc { "AWS| " }]
AWS.pry
@lsegal
lsegal / module_prepend.rb
Created February 28, 2013 08:02
On a positive note, AOP with mixins just got way simpler in Ruby 2:
module Helper
def help
puts "Hello,"
super
end
end
class Foo
def help
puts "Do you need help?"