Skip to content

Instantly share code, notes, and snippets.

View eddroid's full-sized avatar

Ed Toro eddroid

View GitHub Profile
@eddroid
eddroid / functions.js
Last active January 31, 2018 22:25
cohort 22
// because of hoisting, variables are typically declared at the top of the "scope"
// var a = 1;
// var b;
// var h = "hello";
// you can declare multiple variables at once
// var a = 1, b, h = "hello";
// make sure the file is working
// console.log('hello');
@eddroid
eddroid / rapid.md
Last active October 1, 2023 01:57
Rapid Prototyping with Rails

Rapid Prototyping with Rails

At Wyncode we turn people into full-stack web developers in 10 weeks. So we've learned a few tricks to get from 0 to webapp quickly.

Install Ruby and Rails

Generate the app skeleton

@eddroid
eddroid / hello.rb
Last active January 11, 2018 16:58
# title
puts "Chapter 1"
# line 1
puts "It was the best of times"
# rest of the text
puts "It was the wrost of times"
@eddroid
eddroid / bookmark.js
Last active November 7, 2016 20:53
Bypassing Paywalls
// Paste into the JavaScript console.
//
// Add "javascript:" to the front if you want to bookmark it
// South Florida Business Journal
$('.content--embargoed').attr('style', 'display: block !important; opacity: 1');$('.paywall--premium').remove();$('.paywall--free').remove();$('.paywall--free').hide();$('.content__segment').show();
// Miami Herald
$("#ppUI").hide() && $("#pressplusOverlay").hide()
@eddroid
eddroid / parser.rb
Created September 27, 2016 21:12
broken HTML parser FSM
class Node
def initialize(xml_str)
@name = @attributes = @content = ''
parse(xml_str)
p @name, @attributes, @content
end
def parse(xml_str)
# state indicators
inside_tag = inside_tag_name = inside_tag_attributes = false
@eddroid
eddroid / puma_hunter.md
Last active August 12, 2016 04:17
Puma Hunter

Puma Hunter

Hunts down and kills loose Puma Rails server processes.

Build

You only need to run this once.

# Terminal
@eddroid
eddroid / game_of_life.rb
Last active October 7, 2015 21:18
Cohort 7
require 'rspec/autorun'
# A Set is an Array that is automatically de-duplicated (uniq'd)
require 'set'
####
## Coordinate
##
## an x,y coordinate pair
@eddroid
eddroid / alphabet_testers.rb
Last active October 7, 2015 21:20
C6: scratchpad
module AlphabetTesters
# self methods
# activated on require
# must be called with namespace
# e.g. AlphabetTesters.a?
def self.a?(letter)
letter.downcase == "a"
end
def self.b?(letter)
@eddroid
eddroid / batman.rb
Created June 18, 2015 19:40
C6: Batman REPL Game
# display a line on the screen
#
# refactoring to
# - remove some Ruby jargon by defining a
# domain-specific-language (DSL)
# - remove some repetitive (copy-pasted) code
# - have a single place to change the line width
def put_a_line
puts "*" * 50
end
@eddroid
eddroid / same_thing.md
Last active January 19, 2016 21:33
The Same Thing Over and Over

Scope

Think of a telescope. As it extends right, it gets smaller.

__
|| __
|| || __
|| || || 
|| || __
|| __