This file contains hidden or 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
using System; | |
using System.Collections.Generic; | |
using System.Data.Objects; | |
using System.Linq; | |
using System.Linq.Expressions; | |
using System.Text; | |
namespace JacobSimeon.Extensions | |
{ | |
public static class IQueryableExtensions |
This file contains hidden or 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
var shorten = function(){ | |
var frame = document.createElement('iframe'); | |
var body = document.body; | |
var location = document.location; | |
var url = ""; | |
if (!body) { | |
document.alert("Unable to shorten the url, try again after the page finishes loading"); | |
return; | |
} |
This file contains hidden or 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
var calculate_payment = function(loan_amount, interest_rate){ | |
var _rate = interest_rate / 1200; | |
var pi = ( _rate + (_rate / (Math.pow((1 + _rate), 360) - 1) ) ) * loan_amount; | |
var taxes = (loan_amount * 0.01) / 12; | |
var ins = 40; | |
var mi = (loan_amount * 0.0125) / 12; | |
return pi + taxes + ins + mi; | |
} | |
for(var i = 120; i <= 160; i++){ |
This file contains hidden or 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
root_dir = ARGV[0] || "." | |
ext = ARGV[1] || "rb" | |
pattern = "#{root_dir}/**/*.#{ext}" | |
puts "Counting lines in files which match: #{pattern}" | |
count = 0 | |
Dir[pattern].each do |file| | |
lines_in_file = 0 | |
if File.exists? file | |
contents = File.read(file).split("\n") |
This file contains hidden or 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
alias rr='touch tmp/restart.txt' | |
alias apache_logs='cd /private/var/log/apache2/' | |
alias vhosts='vim /private/etc/apache2/users/jacob.conf' | |
alias hosts='vim /etc/hosts' | |
alias profile='vim ~/.bash_profile' | |
alias apache='sudo apachectl' | |
alias mongo_start='mongod run --config /usr/local/Cellar/mongodb/1.6.3-x86_64/mongod.conf' | |
alias cleardns='dscacheutil -flushcache' | |
alias grma='git ls-files --deleted -z | xargs -0 git rm' | |
alias cleanswap='find . | grep .swp | xargs rm' |
This file contains hidden or 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
# include this file in <RAILS_ROOT>/config | |
if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm') | |
begin | |
rvm_path = File.dirname(File.dirname(ENV['MY_RUBY_HOME'])) | |
rvm_lib_path = File.join(rvm_path, 'lib') | |
$LOAD_PATH.unshift rvm_lib_path | |
require 'rvm' | |
RVM.use_from_path! File.dirname(File.dirname(__FILE__)) | |
rescue LoadError |
This file contains hidden or 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
SELECT col.attrelid::regclass as table, | |
col.attname as name, | |
format_type(col.atttypid, col.atttypmod) as type, | |
col.attnotnull as not_null, | |
def.adsrc as default, | |
( SELECT d.refobjid | |
FROM pg_depend d | |
WHERE col.attrelid = d.refobjid | |
AND col.attnum = d.refobjsubid | |
LIMIT 1 |
This file contains hidden or 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
`gem list --no-versions`.split("\n").each do |gem| | |
`gem list -d #{gem}`.gsub(/Installed at(.*):.*/).each do |dir| | |
dir = dir.gsub(/Installed at(.*): /,'').gsub("\n", '') | |
system "gem uninstall #{gem} -aIx -i #{dir}" | |
end | |
end |
NewerOlder