Skip to content

Instantly share code, notes, and snippets.

class SecretHandshake
def initialize(input)
@data = input
@solution = []
end
def commands
unless @data.to_i == 0
@data = @data.to_s(2)
@wb4r
wb4r / ocr.rb
Created October 3, 2015 12:20
Exercism's OCR Numbers - Ruby
class OCR
attr_accessor :text
OCR_DB = {
[' _ ', '| |', '|_|'] => '0',
[' ', ' |', ' |'] => '1',
[' _ ', ' _|', '|_ '] => '2',
[' _ ', ' _|', ' _|'] => '3',
[' ', '|_|', ' |'] => '4',
[' _ ', '|_ ', ' _|'] => '5',
@wb4r
wb4r / triplet.rb
Created October 8, 2015 10:14
Pithagorean Triplet
class Triplet
attr_reader :alfa, :bravo, :charlie
def initialize(alfa, bravo, charlie)
@alfa = alfa
@bravo = bravo
@charlie = charlie
end
def sum
@wb4r
wb4r / simulator.rb
Created October 23, 2015 11:41
Robot Simulator Challenge - Ruby
require 'pry'
class Robot
attr_reader :compass
def initialize
@compass = [:north, :east, :south, :west]
@facing_to = true
@x_axis = []
@y_axis = []
@wb4r
wb4r / JavaScript-myNotes.js
Last active January 23, 2016 12:33
Notes and Shortcuts to JavaScript
:::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::: INDEX :::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::
1- PRIMITIVES VS. OBJECTS
2- NULL VS. UNDEFINED
3- FUNCTION DECLARATION AND FUNCTION EXPRESSION
4- JS FUNCTION-S: FIRST CLASS VALUES
5- ANONYMOUS FUNCTIONS, SCOPE AND CLOSURE
6- FUNCTION EXPRESSION WITH GROUPING OPERATORS
THIS AND $(THIS) IN JAVASCRIPT AND jQuery
by Willem T for LauchSchool.com – FE2 Assessment 249
–---- Definition –----
@wb4r
wb4r / cities.json
Last active February 25, 2016 11:23
[
{
"city": "New York",
"growth_from_2000_to_2013": "4.8%",
"latitude": 40.7127837,
"longitude": -74.0059413,
"population": "8405837",
"rank": "1",
"state": "New York"
},
@wb4r
wb4r / views.js
Created February 25, 2016 14:55
backbone collection selection
App.ResultView = Marionette.ItemView.extend({
template: "#js-result",
})
App.ResultsView = Marionette.CompositeView.extend({
tagName: "ul",
// className: ".suggestions",
childView: App.ResultView,
template: "#js-results",
// this.listenTo("show", this.filter()),
@wb4r
wb4r / cities.json
Created February 25, 2016 17:37
larger file
[
{
"city": "New York",
"growth_from_2000_to_2013": "4.8%",
"latitude": 40.7127837,
"longitude": -74.0059413,
"population": "8405837",
"rank": "1",
"state": "New York"
},
2016-02-29T21:36:19.668818+00:00 heroku[router]: at=info method=GET path="/css/vendor/backbone.modal.theme.css" host=pure-river-85638.herokuapp.com request_id=d4764083-8e82-462d-9bb8-aee383a4bd7c fwd="213.152.161.35" dyno=web.1 connect=1ms service=2ms status=304 bytes=178
2016-02-29T21:36:19.651712+00:00 heroku[router]: at=info method=GET path="/css/vendor/backbone.modal.css" host=pure-river-85638.herokuapp.com request_id=562feef9-b283-4acc-9142-2ddf08565bf5 fwd="213.152.161.35" dyno=web.1 connect=2ms service=2ms status=304 bytes=176
2016-02-29T21:36:19.637946+00:00 heroku[router]: at=info method=GET path="/css/vendor/bootstrap.css" host=pure-river-85638.herokuapp.com request_id=cab133f2-742c-451f-8b66-6a1c02d48a08 fwd="213.152.161.35" dyno=web.1 connect=1ms service=4ms status=304 bytes=179
2016-02-29T21:36:19.674544+00:00 heroku[router]: at=info method=GET path="/js/vendor/jquery-ui.min.js" host=pure-river-85638.herokuapp.com request_id=8a5fbe31-1d3b-4be5-83ff-59720dc807eb fwd="213.152.161.35" dyno=web.1 con