Skip to content

Instantly share code, notes, and snippets.

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'
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)
@a2f0
a2f0 / gist:3dbf7a087a42373a6407
Last active August 29, 2015 14:05
detect hung passenger processes by inspecting an isolated application pool, iterating, and authing against the api
#!/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 |
@a2f0
a2f0 / gist:6371c0ab2d72d555cd7c
Created August 28, 2014 07:04
awesome SVG example
<!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>
@a2f0
a2f0 / gist:5d8309046e5ec1ae55dd
Created September 13, 2014 20:10
javascript star code
<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");
[notroot@aaa-shelob03 ~]$ whoami
notroot
[notroot@aaa-shelob03 ~]$ \curl -sSL https://get.rvm.io | sudo bash -s stable
[sudo] password for notroot:
Downloading https://github.com/wayneeseguin/rvm/archive/1.26.9.tar.gz
Downloading https://github.com/wayneeseguin/rvm/releases/download/1.26.9/1.26.9.tar.gz.asc
gpg: Signature made Wed 07 Jan 2015 05:55:10 AM CST using RSA key ID BF04FF17
gpg: Good signature from "Michal Papis (RVM signing) <mpapis@gmail.com>"
gpg: WARNING: This key is not certified with a trusted signature!
@a2f0
a2f0 / gist:0be3e80db9b21ce7b989
Created February 1, 2015 15:44
module dependency resolution
angular.module('myApp', ['ngRoute', 'config']) ...
.controller('myController',['$scope', 'myApp', 'CONFIG', function($scope, myApp, CONFIG){
console.log("CONFIG " + CONFIG);
}
@a2f0
a2f0 / gist:c1d8f3536ade65e8eb35
Last active August 29, 2015 14:18
schema.xml
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@a2f0
a2f0 / gist:fbe39890a3578f169ad7
Created July 30, 2015 15:10
braintree tokenizecard js
client.tokenizeCard({
number: $scope.ngTransaction.$transaction.cc,
cardholderName: cardholdername,
// You can use either expirationDate
expirationDate: "10/20",
// or expirationMonth and expirationYear
//expirationMonth: "10",
//expirationYear: "2015",
// CVV if required
//cvv: "832",