Skip to content

Instantly share code, notes, and snippets.

Started POST "/api/users" for 127.0.0.1 at 2013-03-18 12:58:37 +0000
Processing by Api::UsersController#create as JSON
Parameters: {"avatar_url"=>"/assets/placeholder-160x160.png", "email"=>"bruno.abrantes@clubjudge.com", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]", "user"=>{"avatar_url"=>"/assets/placeholder-160x160.png", "email"=>"bruno.abrantes@clubjudge.com", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}}
WARNING: Can't verify CSRF token authenticity
[23509a-backend-cli] calling get, locales?
[23509a-backend-cli] call succeeded
[8575c9-backend-cli] calling post, users
[8575c9-backend-cli] error 500 Internal Server Error: RuntimeError at /users
======================
@inf0rmer
inf0rmer / hostapd-starter
Created June 30, 2015 18:55
Starting hostapd when WiFi goes down
#!/bin/bash
#
# Interface checker
# Checks to see whether interface has an IP address, if it doesn't assume it's down and start hostapd
# Author : SirLagz
#
Interface='wlan0'
HostAPDIP='10.0.0.1'
echo "-----------------------------------"
echo "Checking connectivity of $Interface"
@inf0rmer
inf0rmer / grunt.js
Created July 3, 2012 22:02
Sample Grunt JS configuration file by steve8708
// My current grunt.js file, includes examples for compiling less,
// handlebars templates, file watching, etc
//
// My most used task is the "watch-serve" task for linting/testing
// my files as I work, has been amazingly helpful
//
// This is a custom modification of @tbranyen's fantastic
// boilerplate-handlebars-layoutmanager project gruntfile
//
// NOTE: for this to work you need to install the below npm tasks
@inf0rmer
inf0rmer / scaffold.sh
Created April 6, 2011 11:55
Bash script to create a new Drupal website scaffold
#!/bin/bash
CURRENT=`pwd`
echo -n "Enter directory to scaffold into... Use blank for $CURRENT "
read DIRECTORY
if [ -z $DIRECTORY ] && [ "${DIRECTORY+xxx}" = "xxx" ]
then
DIRECTORY=$CURRENT
fi
@inf0rmer
inf0rmer / blanket-dynamic-actions-yard.rb
Created December 30, 2014 17:12
Documenting dynamically created REST actions in Blanket
# @macro [attach] REST action
# @method $1()
# Performs a $1 request on the wrapped URL
# @param [String, Symbol, Numeric] id The resource identifier to attach to the last part of the request
# @param [Hash] options An options hash with values for :headers, :extension and :params
# @return [Blanket::Response, Array] A wrapped Blanket::Response or an Array
def add_action(action)
#...
end
@inf0rmer
inf0rmer / blanket-exception-yard.rb
Created December 30, 2014 17:08
Blanket::Exception's initialize method documented
# Creates a new exception
# @param [HTTParty::Response] response the HTTP Response
# @return [Blanket::Exception] The Blanket Exception object
def initialize(response = nil)
#...
end
@inf0rmer
inf0rmer / blanket-raise-exception-direct.rb
Last active August 29, 2015 14:12
Raising a well-known exception directly in Blanket
raise Blanket::InternalServerError.new
@inf0rmer
inf0rmer / blanket-raise-exception.rb
Created December 30, 2014 16:58
Raising a well-known exception using EXCEPTIONS_MAP in Blanket
raise Blanket::Exceptions::EXCEPTIONS_MAP[500].new
@inf0rmer
inf0rmer / blanket-generating-exception-classes.rb
Created December 30, 2014 16:53
Automatically generating ~60 Blanket::Exception subclasses
STATUSES.each_pair do |code, message|
klass = Class.new(Exception) do
send(:define_method, :message) {"#{code ? "#{code} " : ''}#{message}"}
end
klass_constant = const_set message.delete(' \-\''), klass
Exceptions::EXCEPTIONS_MAP[code] = klass_constant
end
@inf0rmer
inf0rmer / http-statuses.rb
Last active August 29, 2015 14:12
Well-known HTTP status codes and their meanings (abridged)
STATUSES = {
# ...
400 => 'Bad Request',
401 => 'Unauthorized',
402 => 'Payment Required',
403 => 'Forbidden',
404 => 'Resource Not Found',
405 => 'Method Not Allowed',
406 => 'Not Acceptable',
407 => 'Proxy Authentication Required',