This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($){ | |
var map = { | |
pickup: 1, | |
driver: 2, | |
fare: 3, | |
car: 4, | |
city: 5, | |
payment_method: 6 | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Just copy and paste the lines below (all at once, it won't work line by line!) | |
# MAKE SURE YOU ARE HAPPY WITH WHAT IT DOES FIRST! THERE IS NO WARRANTY! | |
function abort { | |
echo "$1" | |
exit 1 | |
} | |
set -e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Start a local webserver to serve the file of your current directory on the LAN: | |
# Python version 2.x: | |
python -m SimpleHTTPServer | |
# Python version 3.x: | |
python3 -m http.server | |
#Start a local SMTP server to debug your app emails. Emails will be printed on stdout: | |
python -m smtpd -c DebuggingServer -n | |
#Parse and prettify a JSON string with: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# load libraries | |
require 'rubygems' rescue nil | |
require 'wirble' | |
#require 'json' | |
alias q exit | |
class Object | |
def local_methods | |
(methods - Object.instance_methods).sort |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint-env node */ | |
var path = require('path'); | |
var _ = require('lodash'); | |
var here = require('path-here'); | |
/** | |
* Current Environment | |
* @type {string} | |
*/ | |
process.env.NODE_ENV = process.env.NODE_ENV || 'test'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def power_sum(base, expo) | |
num = base | |
2.upto(expo) { |i| num *= base } | |
sum = 0 | |
num.to_s.split(//).each { |i| sum += i.to_i } | |
p sum | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def is_prime?(num) | |
2.upto(num-1) { |i| return false if ((num % i) == 0) } | |
true | |
end | |
def largest_prime(num) | |
primes = [] | |
1.upto(num) { |i| primes << i if num % i == 0 && is_prime?(i) } | |
p primes.last |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def three_five(max) | |
nums = [] | |
1.upto(max-1) { |i| nums << i if i % 3 == 0 || i % 5 == 0 } | |
p nums.reduce(:+) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def is_palindrome?(num) | |
num == num.to_s.reverse.to_i ? true : false | |
end | |
def palindromatic | |
range = *(100..999) | |
results = [] | |
range.each { |i| range.each { |x| results << (i*x) if is_palindrome?(i*x) } } |
NewerOlder