Skip to content

Instantly share code, notes, and snippets.

View jszmajda's full-sized avatar

Jess Szmajda jszmajda

View GitHub Profile
@jszmajda
jszmajda / gist:7815695
Created December 5, 2013 23:07
Simple rack server without http
require 'rack'
require 'rack/content_length'
require 'rack/rewindable_input'
raw = File.read('simple.ru')
app = eval("Rack::Builder.new {( #{raw} )}.to_app")
a = Rack::Builder.new do
use Rack::ContentLength
use Rack::Chunked
use Rack::CommonLogger, $stderr
@jszmajda
jszmajda / list.txt
Created July 18, 2013 17:20
"Anonymous" house email / password list. Pasted here so people on the hill can safely access it without fear of poisoned sites.
NOTE: FOR THE PURPOSES OF BEING FAR TOO GENEROUS WITH YOU GUYS, WE HAVE REMOVED SOME OF THE PASSWORDS AND SHUFFLED THE ORDER OF THE REMAINING ONES.
THESE ARE ALL CURRENT, VALID CREDENTIALS BUT THEY ARE NOT IN THE ORIGINAL PAIRINGS. WE RESERVE THE RIGHT TO SPONTANEOUSLY DECIDE THIS RESTRAINT WAS UNJUSTIFIED.
EMAIL: PASSWORD
sheena.arora@mail.house.gov:
jo@mail.house.gov:
Brianne.Nadeau@mail.house.gov: doddsquad1
deleted@mail.house.gov: Holler!8
dan.mcdonald@mail.house.gov:
rails new blog
cd blog
rails server
http://localhost:3000
rails generate controller welcome index
`rvm use 1.9.3`
# Fire up irb
class Sample
def hello
puts "Hello, World!"
end
end
s = Sample.new
@jszmajda
jszmajda / Readme.md
Created March 25, 2013 18:32
template loading in angular.js with rails

Basically the angular_templates helper method creates script tags like

<script type="app/x-angular-template" name="whichever_app/templates/foo">
  template code here as html with {{}}s etc
</script>

We then reference that in angular with jQuery via $("script[name='whichever_app/templates/foo']").html().

Ember.Handlebars.registerBoundHelper('selectorType', function(name, options) {
if (name === null || name === void 0 || name === "") {
name = 'default';
}
return Ember.Handlebars.compile("{{template _selectors_" + name + "}}")(options.contexts[0], options);
});
@jszmajda
jszmajda / rubygems-sha512.joshsz.atomos.txt
Created January 31, 2013 21:43
result of sha512 for my gems
SHA512(./.gem/cache/actionmailer-3.0.7.gem)= ede0846e3b59167a3b6246e6c7c397057f2086aebf90d064185a2c963db5842fdfa14b88b7578e62c97243b5465a72838f1129b2ca585e2a84984a7271f4e43b
SHA512(./.gem/cache/actionpack-2.3.8.gem)= 3aabd2544db76c61e52e13cc02c65f0c1698f52bbec4750d6de3d3162b0e17bc3f0fffd5dd6e09afc5200a7249a697825ab1784398b95e05d5841a8085f553a0
SHA512(./.gem/cache/activeresource-2.3.5.gem)= 05504f2b73af2ba9fab712ce2358e32fc0bbd7260fabe56deb877ed99c3e28735a94224ecc979f5e2115c4e6cb04e8d5414aa8848cbc80a7c7c3f6c5be3715cc
SHA512(./.gem/cache/abstract-1.0.0.gem)= 7c6fffc012baf704a27470fecf44dc97e6ca9f5bf9db47c20f23e59376af1262c4618ad70a70faa446339a79f94bbce04c2f5a6c506bd010c60a0fa5f60f346c
SHA512(./.gem/cache/bundler-1.0.7.gem)= 25da5fa96d397fd18c9c86204e91dc0fa087cd7d4dc0f33f06d41b4b722350d09b17d0050ed09c931fea7d5fc14b684527395aa777391eb0a9c163657e0e1142
SHA512(./.gem/cache/builder-2.1.2.gem)= a2bf3bb87e7e9314c7600358861c4c4c9bd977b68324fbca82429473275e8a899481abf1acef9f799d89f928100d660d2fff56d516da7c0f27f12071428
@jszmajda
jszmajda / gist:4420949
Last active December 10, 2015 10:28
Dot Notation. Useful?
gnarly = {
foo: {
name: 'Baz',
stuffs: [ 1, 2, 3 ]
},
bars: [
{a: 1, b: 2},
{a: 51, b: 92},
{a: 71, b: 81, c: 104}
]
@jszmajda
jszmajda / y_combinator.rb
Created November 5, 2012 22:07
My notes from Jim Weirich's Y Combinator talk
puts ->() {
# ->(n) { n.zero? ? 1 : n * fact.(n-1) }.(5)
#
#->(improver) {
# improver.(improver)
#}.(
# ->(improver) {
# ->(n) {
# n.zero? ? 1 : n * improver.(improver).(n-1)
@jszmajda
jszmajda / gol.hs
Created November 3, 2012 22:35
Game of life in Haskell
data Aliveness = Alive | Dead deriving (Show, Eq)
survives :: Aliveness -> Int -> Aliveness
survives _ 3 = Alive
survives Alive 2 = Alive
survives _ _ = Dead
data Point = Point { px :: Int, py :: Int } deriving (Show, Eq)
data Cell = Cell { pt :: Point } deriving (Show, Eq)
data Grid = Grid { cells :: [Cell] } deriving (Show)