Skip to content

Instantly share code, notes, and snippets.

View raySavignone's full-sized avatar

Ramon Savignone raySavignone

  • Savignone Technologies
  • Vancouver Canada
View GitHub Profile
@raySavignone
raySavignone / arrayOfLight.js
Created April 13, 2015 19:11
Array of light
var arrayOfLight = function(positiveNumber){
if (positiveNumber < 0 ) {
alert("Number must be a positive");
} else {
var result = [];
for (i=0; i <= positiveNumber;i++) {
result[i] = i;
}
console.log(result);
}
@raySavignone
raySavignone / Debuging in javascript
Created April 13, 2015 18:51
debugging exercises
// Why is this broken?
// Has the second variable assignment mispelling the variable name.
var mySuperAwesomeVariableName = "Ted Mosby";
mysuperAwesomeVariableName = "BATMAN!";
console.log(mySuperAwesomeVariableName);
// What's missing? How does JS interpret empty line endings?

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@raySavignone
raySavignone / Hamlet.txt
Last active August 29, 2015 14:16
File I/O
THE TRAGEDY OF HAMLET, PRINCE OF DENMARK
by William Shakespeare
Dramatis Personae
Claudius, King of Denmark.
require 'pry'
def separating_logic(arr)
return arr if arr.length == 1
mid_point = arr.length / 2
left_half = arr[0,mid_point]
right_half = arr[mid_point, arr.length]
# binding.pry
sorting_algorithm(separating_logic(left_half),separating_logic(right_half))
end
@raySavignone
raySavignone / play with irb
Created March 3, 2015 22:09
Playing around with irb
vagrant [day_2]> irb
2.1.3 :001 > puts "hello"
hello
=> nil
2.1.3 :002 > "khurram".reverse
=> "marruhk"
2.1.3 :003 > ramon
NameError: undefined local variable or method `ramon' for main:Object
from (irb):3
from /usr/local/rvm/rubies/ruby-2.1.3/bin/irb:11:in `<main>'
def method_fb(s, f)
s.upto(f) { |x|
puts e(x)
}
end
def method_e(y)
if div_3?(y) && div_5?(y)
"FizzBuzz"
elsif div_5?(y)