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
`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 |
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
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 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 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 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 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 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 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 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
# Regular expression to require the following | |
# Thanks to Scott Chamberlain on Stack Overflow | |
# http://stackoverflow.com/questions/3721843 | |
# All ASCII printing characters | |
# At least 8 characters in length | |
# At least 1 lowercase letter | |
# At least 1 uppercase letter | |
# At least 1 special character | |
# No white-space characters | |
# At least 1 number |
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
select t.name as TableWithForeignKey, fk.constraint_column_id as FK_PartNo , c.name as ForeignKeyColumn | |
from sys.foreign_key_columns as fk | |
inner join sys.tables as t on fk.parent_object_id = t.object_id | |
inner join sys.columns as c on fk.parent_object_id = c.object_id and fk.parent_column_id = c.column_id | |
where fk.referenced_object_id = (select object_id from sys.tables where name = 'PriorAuthorizationRequests') | |
order by TableWithForeignKey, FK_PartNo |
OlderNewer