Skip to content

Instantly share code, notes, and snippets.

View maxluzuriaga's full-sized avatar

Max Luzuriaga maxluzuriaga

View GitHub Profile
<?php
// echo exec('echo $PATH');
// echo ' ';
// echo exec('whoami');
// echo ' ';
// echo exec('ls -la /usr/local/sbin');
// echo ' ';
// echo exec('ls -la /usr/local/bin');
// echo ' ';
$(document).ready(function() {
var key = 'AIzaSyDt5uZerbNhxGA6nxGvgV0ul3ijJIIm_ok';
var calID = 'hackatbrown.org_mguoo6bi9fdk79ruracndg3gjk@group.calendar.google.com';
$.ajax({
type: 'GET',
url: encodeURI('https://www.googleapis.com/calendar/v3/calendars/' + calID + '/events?key=' + key + '&singleEvents=true&orderBy=startTime'),
dataType: 'json',
success: function(response) {
response.items = response.items || [];
@maxluzuriaga
maxluzuriaga / clickify.js
Last active August 29, 2015 14:01 — forked from maxweisel/clickify.js
Edited clickify.js to check if pushState exists before passing link off to BackBone. This way, if the browser does not support pushState, you still get the benefit of pretty (read: without hashbang) urls that work in every browser, at the expense of the entire backbone app reloading on every request in browsers without pushState.
(function($){
// Declare the rootUrl used for filtering internal links.
var rootUrl = document.location.protocol + '//' + (document.location.hostname || document.location.host) + (document.location.port ? ':' + document.location.port : '') + '/';
// Helper functions
var getFragment = function(url, root) { // Grab the fragment and format it how Backbone expects
var fragment = url;
if (fragment.indexOf(':') !== -1)
fragment = fragment.replace(/.*:\/\/[^\/]+/, '');
if (!fragment.indexOf(root)) fragment = fragment.substr(root.length);
@maxluzuriaga
maxluzuriaga / fogcreek.rb
Created April 25, 2014 23:37
Fog Creek Puzzle Solution
LETTERS = "acdegilmnoprstuw"
def reverse(h, str)
if (h == 7)
return str.reverse
elsif (h < 7)
return false
end
if ((h % 1) != 0)
require "PartyMix"
Shoes.app :width => 360, :height => 180, :scroll => false, :title => "Music Player" do
background firebrick..rgb(100, 0, 0)
@pm = PartyMix.new
stack do
@caption = para "Music Player by M-Dawg", :size => 18, :stroke => white
@status = para "No audio/ video file selected", :size => 12, :stroke => white
@maxluzuriaga
maxluzuriaga / montyhall.rb
Created September 15, 2013 00:02
A ruby simulation of the Monty Hall problem: http://en.wikipedia.org/wiki/Monty_Hall_problem
cars_found = 0
2000.times do
# 0 = goat, 1 = car
doors = [0, 0, 0]
doors_indices = [0, 1, 2]
car_door = rand(0..2)
doors[car_door] = 1
@maxluzuriaga
maxluzuriaga / arabic_roman_converter.rb
Last active December 22, 2015 19:19
Arabic to roman numeral converter
print "Number? "
num = gets.chomp.to_i
dict = { 1 => "I", 5 => "V", 10 => "X", 50 => "L", 100 => "C", 500 => "D", 1000 => "M" }
result = []
[1000, 100, 10, 1].each do |n|
x = num % n
if x == num
@maxluzuriaga
maxluzuriaga / uicolorgenerate.rb
Created July 23, 2011 21:58
UIColor Generator From Hex Color Value
#!/usr/bin/env ruby
# Usage:
# uicolorgenerate 0f84d5
# to copy result to clipboard (on a Mac), use:
# uicolorgenerate 0f84d5 | pbcopy
def main(color_string)
case color_string
when "fff", "ffffff"
@maxluzuriaga
maxluzuriaga / Sample data
Created December 12, 2010 17:15
Populates a Rails application I'm working on with some sample data.
require 'faker'
namespace :db do
desc "Fill database with sample data"
task :populate => :environment do
Rake::Task['db:reset'].invoke
make_authors
make_sections
make_posts
make_comments
@maxluzuriaga
maxluzuriaga / Newtonian Calculator
Created November 6, 2010 17:30
Command-line Ruby application for automating some physics equations based on Newton's Laws. Includes weight, gravity, and acceleration due to gravity.
class Calculator
attr_accessor :exits
@@constant = 0.0000000000667
def welcome
puts "\n<< Welcome >>\n\n"
puts 'type in "help" to see all available options'
end