Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am luxerama on github.
  • I am luxerama (https://keybase.io/luxerama) on keybase.
  • I have a public key whose fingerprint is 82DD C033 DA28 B14E 8691 4170 E535 753F 486A 879A

To claim this, I am signing this object:

@luxerama
luxerama / navigation.rb
Last active August 29, 2015 14:19
Navigation configuration example
Navigation::Configuration.setup do |navigation|
navigation.options do |options|
options.option :current_user? do
current_user?
end
options.option :current_user_verified? do
current_user.verified? rescue false
end
option.option :current_user_first_name do
#!/bin/bash
if [ -z "${SAUCE_USERNAME}" ] || [ -z "${SAUCE_ACCESS_KEY}" ]; then
echo "This script can't run without your Sauce credentials"
echo "Please set SAUCE_USERNAME and SAUCE_ACCESS_KEY env variables"
echo "export SAUCE_USERNAME=ur-username"
echo "export SAUCE_ACCESS_KEY=ur-access-key"
exit 1
fi
echo "Using temp dir $SAUCE_TMP_DIR"
#!/bin/bash
# Setup and start Sauce Connect for your TravisCI build
# This script requires your .travis.yml to include the following two private env variables:
# SAUCE_USERNAME
# SAUCE_ACCESS_KEY
# Follow the steps at https://saucelabs.com/opensource/travis to set that up.
#
# Curl and run this script as part of your .travis.yml before_script section:
# before_script:
@luxerama
luxerama / grape_log_request_subscriber.rb
Last active December 12, 2016 15:31
Grape Log Instrumentation
class GrapeRequestLogSubscriber < ActiveSupport::LogSubscriber
def grape_controller(event)
request = Rack::Request.new(event.payload).env
response = Rack::Response.new(event.payload)
data = extract_request(request)
data.merge! extract_status(response)
logger.send(:warning, data.to_json)
end

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert $1 -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 $2

Results

{
"data":[
{
"type":"listordered",
"data":[
{
"type":"list-element",
"element":"list-item6",
"data":{
"title":"Ex's sister",
2013-12-16 11:07:06.005 Beans ID[4738:80b] Cannot find executable for CFBundle 0xc3d4ba0 </Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sd
k/System/Library/AccessibilityBundles/GeoServices.axbundle> (not loaded)
2013-12-16 11:07:06.060 Beans ID[4738:80b] Cannot find executable for CFBundle 0x11f37ff0 </Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.s
dk/System/Library/AccessibilityBundles/CertUIFramework.axbundle> (not loaded)
2013-12-16 11:07:06.583 Beans ID[4738:80b] (
UIViewController,
PKRevealController
)
2013-12-16 11:07:06.584 Beans ID[4738:80b] (
UIViewController,
class Auth
attr_accessible :token
def authorised?
token = self.token if token.valid?
token =|| token.refresh
token ? true : false
end
end
class Proc
def callback(callable, *args)
self === Class.new do
method_name = callable.to_sym
define_method(method_name) { |&block| block.nil? ? true : block.call(*args) }
define_method("#{method_name}?") { true }
def method_missing(method_name, *args, &block) false; end
end.new
end
end