Skip to content

Instantly share code, notes, and snippets.

View oliverswitzer's full-sized avatar
🏠
Working from home

Oliver Switzer oliverswitzer

🏠
Working from home
View GitHub Profile
@oliverswitzer
oliverswitzer / module.rb
Created February 24, 2014 18:42
An example of a module!
module MyModule
def first_module_method
end
end
@oliverswitzer
oliverswitzer / jQuery.js
Created February 24, 2014 18:48
jQuery example
$('div').on("click", function() {
console.log("I'm a callback function and I'm currently getting called!");
});
@oliverswitzer
oliverswitzer / module.js
Created February 24, 2014 18:54
Node.js Module Example!
// dirListModule.js
var fs = require('fs'); //require node filesystem module
var path = require('path'); //require node path module (a couple of tools for reading path names)
module.exports = function filterDirFiles(pathSupplied, extFilter, callback) {
function extension(element) {
var extName = path.extname(element);
return extName === '.' + extFilter;
};
@oliverswitzer
oliverswitzer / callingANodeModule.js
Created February 24, 2014 19:08
Example of calling my own custom module in Node
var dirListModule = require('./dirListModule.js')
var dirPath = process.argv[2];
var extFilter = process.argv[3];
dirListModule(dirPath, extFilter, function(err, filteredList) {
filteredList.forEach(function(value) {
console.log(value);
});
});
@oliverswitzer
oliverswitzer / barchart_update.rb
Created March 5, 2014 19:45
Updated working (sort of) barchart for BetaNYC Timeline Group!
<html>
<head>
<style>
.bar {
fill: steelblue;
}
.axis text {
font: 10px sans-serif;
@oliverswitzer
oliverswitzer / example-data.json
Created March 27, 2014 20:59
The crappy JSON I got back from Mixpanel's API
{"event":"first visit","properties":{"time":1389806707,"distinct_id":"14398a6d7eb77-0308ffb76-6e1a2776-384000-14398a6d7ec2b4","$browser":"Chrome","$city":"New York","$initial_referrer":"$direct","$initial_referring_domain":"$direct","$os":"Mac OS X","$region":"New York","date":{},"mp_country_code":"US","mp_lib":"web","url":"http://devolate.com/"}}
{"event":"first visit","properties":{"time":1389806825,"distinct_id":"14398a8a47aa-094bd1e04-6e1a2776-384000-14398a8a47b421","$browser":"Chrome","$city":"New York","$initial_referrer":"$direct","$initial_referring_domain":"$direct","$os":"Mac OS X","$region":"New York","date":{},"mp_country_code":"US","mp_lib":"web","url":"http://devolate.com/"}}
@oliverswitzer
oliverswitzer / includes_module.rb
Last active August 29, 2015 13:57
A simple gist demonstrating how Ruby looks up module methods when they've been included in a class
module Engine
def run
puts "GRRRRRRRRR"
end
end
class Vehicle
@oliverswitzer
oliverswitzer / FizzBuzz
Created November 15, 2013 03:12
My FizzBuzz solution!
1.upto(100) do |i|
if i % 3 == 0
puts "fizz"
elsif i % 5 == 0
puts "buzz"
elsif i % 3 == 0 && i % 5 == 0
puts "fizzbuzz"
else
puts i
end
for(var i = 0; i < 10; i++){
console.log(i);
}
9.times do |i|
puts i
end