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/log/nginx/*.log { | |
daily | |
compress | |
delaycompress | |
rotate 7 | |
missingok | |
sharedscripts | |
postrotate | |
test ! -f /var/run/nginx.pid || kill -USR1 `cat /var/run/nginx.pid` | |
touch /opt/rails/asap/app/2014/current/tmp/restart.txt |
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
# pstree -p | |
init(1)-+-PassengerWatchd(14233)-+-PassengerHelper(14236)-+-ruby(14262)-+-ruby(14386)-+-{ruby}(14388) | |
| | | | |-{ruby}(14391) | |
| | | | `-{ruby}(14392) | |
| | | |-{ruby}(14387) | |
| | | `-{ruby}(14389) | |
| | |-{PassengerHelpe}(14238) | |
| | |-{PassengerHelpe}(14239) | |
| | |-{PassengerHelpe}(14240) | |
| | |-{PassengerHelpe}(14243) |
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
Migration: | |
class CreateJoinTableCommandTag < ActiveRecord::Migration | |
def change | |
create_join_table :commands, :tags do |t| | |
# t.index [:command_id, :tag_id] | |
# t.index [:tag_id, :command_id] | |
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
Here is the command that I can execute against it (the one that I think I should *not* be able to execute. I basically am trying to write a more complex validation that prevents deletion of a tag based on more complex criteria, but would like to first write a base before_destroy validation that causes the deletion to *always* fail no matter what. | |
@command = Command.find(params[:id]) | |
tag = Tag.find(params[:tag_id]) | |
@command.tags.delete(tag) | |
Here is the complete model for tagmapsorter: | |
class Tagmapsorter < ActiveRecord::Base | |
belongs_to :command |
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
Would somebody be able to tell me why these queries are giving me different results when I am executing the same query? I am executing one in active record and one natively via SQLite. | |
SQLite: | |
sqlite> select * from commands LEFT OUTER JOIN tagmapsorters ON tagmapsorters.command_id = commands.id WHERE tagmapsorters.tag_id is NULL; | |
3|hi|2014-01-24 07:07:20.149017|2014-01-24 07:07:20.149017|hi||||| | |
sqlite> select * from commands; | |
2|unix|2014-01-24 06:47:51.701648|2014-01-24 06:47:51.701648|unix | |
3|hi|2014-01-24 07:07:20.149017|2014-01-24 07:07:20.149017|hi | |
4|linux|2014-01-24 07:41:29.121709|2014-01-24 07:41:29.121709|whatever |
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
Started GET "/admin/employees/645114968/blogposts" for 127.0.0.1 at 2014-07-28 17:40:10 -0500 | |
Processing by Admin::BlogpostsController#index as HTML | |
Parameters: {"employee_id"=>"645114968"} | |
AdminUser Load (0.2ms) SELECT "admin_users".* FROM "admin_users" WHERE "admin_users"."id" = 1 LIMIT 1 | |
Completed 500 Internal Server Error in 3ms | |
NoMethodError (undefined method `find' for nil:NilClass): | |
inherited_resources (1.5.0) lib/inherited_resources/belongs_to_helpers.rb:90:in `evaluate_parent' | |
inherited_resources (1.5.0) lib/inherited_resources/base_helpers.rb:144:in `block in association_chain' | |
inherited_resources (1.5.0) lib/inherited_resources/base_helpers.rb:143:in `each' |
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
p = subprocess.Popen(["mysqldump", "--single-transaction", "-u", | |
database_username, "--password="+database_password, "--databases", | |
"--host", server_address, database_name, ], | |
stdout = open( outputfile, 'w') , stderr=subprocess.PIPE) | |
error = p.stderr.read() | |
p_ret = p.wait() | |
print "return code from mysqldump: " + str(p_ret) | |
if (len(error)) > 0: | |
action_error(error) |
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 | |
#Isolate an application pool and iterate through and authenticate | |
#Written by Dan Sullivan | |
#Will detect hung processes | |
IFS=$'\n' | |
for i in $(rvmsudo passenger-status --verbose | | |
pcregrep -M '/opt(.|\n)*^/opt' | | |
grep -v Requests | grep -v ^/ | | |
grep -v "App root" | grep -v CPU | |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>This shows how to get elements inside included svg images from the surrounding html.</title> | |
</head> | |
<body> | |
<object class="emb" data="images/svglogo.svg" width="100" height="100" type="image/svg+xml"></object> | |
<embed class="emb" src="images/svglogo.svg" width="100" height="100" type="image/svg+xml" /> | |
<iframe class="emb" src="images/svglogo.svg" width="100" height="100" style="border:0" ></iframe> | |
<p> |
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
<script>//<![CDATA[ | |
window.addEventListener("load", configRainbow, false); | |
function configRainbow() { | |
var x=document.getElementById("rainy"); | |
var bigstar; | |
if (x.contentDocument) { | |
var star1 = x.contentDocument.getElementById("star1"); | |
var star2 = x.contentDocument.getElementById("star2"); | |
var star3 = x.contentDocument.getElementById("star3"); | |
var star4 = x.contentDocument.getElementById("star4"); |
OlderNewer