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
git status | grep deleted | sed 's/.*deleted:\(.*\)/\1/g' | xargs git 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
insert into admin_users (id, email, encrypted_password, created_at, updated_at) values ('1', '[email protected]', '$2a$10$Xsa8cX1G4jK9EGFV17UkOeTQnMPlp6GNaRld8pnVlIELUWTLY0Xx6', now(), now()); |
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
mvn deploy:deploy-file -Dfile=./hibernate-validator-3.1.0.GA-sources.jar -DgroupId=org.hibernate -DartifactId=hibernate-validator -Dversion=3.1.0.GA -Dpackaging=jar -DgeneratePom=true -Durl=sftp://soa.dev.hq.icentris:22/home/soa/tomcat/webapps/ROOT/repository2 -DrepositoryId=local2 |
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
To perform this SQL statement: | |
----------------------------------------------------------------------------------- | |
select term_id, info_type_id, count(*) from item_feedbacks ifb, items i | |
21where ifb.item_id = i.id and i.source = 'Imgur' | |
group by term_id, info_type_id having count(*) > 15 order by count(*) desc ; | |
Here's the RoR ActiveRecord equivalent: | |
----------------------------------------------------------------------------------- | |
l=ItemFeedback.select("term_id, info_type_id, count(*) as count") |
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
require 'prawn' | |
Prawn::Document.generate("gems.pdf") do | |
`bundle list`.split("\n")[1..-1].map{|s| s.gsub(" * ","")}.each do |g| | |
puts g | |
text "\n\n<b>#{g}</b>", inline_format: true | |
text "---------------------------" | |
s = `gem specification #{g.split.first}` rescue "" | |
description = s.scan( /.*\ndescription: (.*)\nemail.*/m ).last.first rescue nil | |
if !description || description.empty? |
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
#Get source location of all defined methods (or instance_methods) for a given Class | |
klazz=String | |
type=:instance_method # type=:method | |
klazz.send(type.to_s.pluralize.to_sym,false).sort.map{|m| [m,klazz.send(type,m).source_location]}.select{|x| x[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
def my_methods_and_recurse(klazz,results={}) | |
results[klazz.name] = klazz.instance_methods(false) | |
klazz.subclasses.each do |sc| | |
my_methods_and_recurse(sc, results) | |
end | |
results | |
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
# Controllers | |
Dir["#{Rails.root}/../pyr/*/app/controllers/**/*.rb"].each{|p| puts "require #{p}";require p};nil | |
# Models | |
Dir["#{Rails.root}/../pyr/*/app/models/**/*.rb"].each{|p| puts "require #{p}";require p};nil |
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
pyr_models = ActiveRecord::Base.subclasses.map(&:name).select{|c| c =~ /Pyr.*/}.sort | |
pyr_polys = {}.tap{|m| pyr_models.each{|klazz| m[klazz] = begin;obj=klazz.constantize.send(:first); app.polymorphic_path(obj) if obj;rescue Exception => e; e.message;end};nil} | |
pyr_models_mapped = pyr_polys.select{|k,v| v =~ /\/.*/}.keys | |
# Those without polymorphic paths | |
(pyr_models - pyr_models_mapped).sort.each {|m| puts m} | |
# Those with polymorphic paths |
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
NGINX - Configured to forward root domain requests to SSL, subdomains w/o SSL, and to upgrade /faye to websocket | |
-------------------------------------------------------------------------------------------------------------------- | |
upstream my_app_upstream { | |
server unix:///var/run/my_app/my_app.sock; | |
} | |
server { | |
listen 80; | |
server_name mydomain.com; |
OlderNewer