Skip to content

Instantly share code, notes, and snippets.

@wasnotrice
wasnotrice / bash.generate.random.alphanumeric.string.sh
Last active July 11, 2016 16:18 — forked from earthgecko/bash.generate.random.alphanumeric.string.sh
shell/bash generate random alphanumeric string
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
# NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | /usr/bin/env LC_CTYPE=C tr -dc 'a-km-z02-9' | fold -w 32 | head -n 1
@wasnotrice
wasnotrice / SpecHelper.m
Last active August 29, 2015 14:18
Specta failure
#import "SpecHelper.h"
#import <objc/runtime.h>
@implementation SpecHelper
+ (void)load
{
[super load];
//Class klass = NSClassFromString(@"AVYPhotoEditorCustomization");
Class klass = objc_lookUpClass("AVYPhotoEditorCustomization");
Protocol *excludeProtocol = @protocol(SPTExcludeGlobalBeforeAfterEach);
@wasnotrice
wasnotrice / gist:161835a582b747ab2abf
Created June 12, 2014 16:04
opal rspec-its failure
dingo:shoes eric$ rake spec [168/3838](in /Users/eric/code/shoes-atom)
Cannot handle dynamic require :rspec/core:137
Cannot handle dynamic require :rspec/core:137
Cannot handle dynamic require :rspec/support:
Cannot handle dynamic require :shoes/dsl:
NameError: uninitialized constant Core::Warnings
http://localhost:9999/assets/opal/rspec/sprockets_runner.js:2436
http://localhost:9999/assets/opal/rspec/sprockets_runner.js:1349
http://localhost:9999/assets/opal/rspec/sprockets_runner.js:478
@wasnotrice
wasnotrice / style_with_modules.rb
Created May 11, 2014 05:08
Alternate approaches to style with
module Stroke
def stroke
style[:stroke]
end
def stroke=(new_stroke)
style[:stroke] = new_stroke
end
end
@wasnotrice
wasnotrice / index.js
Created May 10, 2014 12:51
requirebin sketch
// example using the raf module from npm. try changing some values!
var requestAnimationFrame = require("raf")
var canvas = document.createElement("canvas")
canvas.width = 500
canvas.height = 500
document.body.appendChild(canvas)
var context = canvas.getContext("2d")
@wasnotrice
wasnotrice / include_extend.rb
Created May 9, 2014 04:46
Alternate ways of adding style_with
module Style
def style
# Special style handling
@style
end
end
module StyleWith
def style_with(*styles)
styles.map(&:to_sym).each do |style|
@wasnotrice
wasnotrice / leaks.txt
Created May 7, 2014 04:30
Shoes leak hunting
Undisposed resources:
1 => [Java::OrgEclipseSwtGraphics::Color]
/Users/eric/code/shoes4/lib/shoes/swt/color.rb:13:in `initialize'
/Users/eric/code/shoes4/lib/shoes/swt/app.rb:17:in `initialize'
/Users/eric/code/shoes4/lib/shoes/app.rb:141:in `setup_gui'
/Users/eric/code/shoes4/lib/shoes/app.rb:58:in `initialize'
/Users/eric/code/shoes4/lib/shoes/app.rb:29:in `app'
/Users/eric/code/shoes4/samples/simple-editor.rb:3:in `(root)'
/Users/eric/code/shoes4/lib/shoes/cli.rb:1:in `load'
/Users/eric/code/shoes4/lib/shoes/cli.rb:1:in `(root)'
@wasnotrice
wasnotrice / last-sha
Created April 18, 2014 18:43
Show the short SHA of the HEAD commit, and copy it to the clipboard (OS X)
#!/usr/bin/env bash
#
# Print the short version of a git revision and copy it
# to the OS X clipboard
REV=${1-HEAD}
git rev-parse --short $REV -- | tee >(tr -d '\n' | pbcopy)
@wasnotrice
wasnotrice / index.html
Last active August 29, 2015 13:55
Items of interest
<html>
<head>
<link rel="stylesheet" type="text/css" href="https://raw.github.com/mrmrs/colors/master/css/colors.css">
</head>
<body>
<p><em>January 2014</em></p>
<article>
<h2><a href="http://bl.ocks.org/">bl.ocks.org</a></h2>
<p>View your gist (html, css, etc) as a web page, by <a href="https://github.com/mbostock">Mike Bostock</a></p>
</article>
@wasnotrice
wasnotrice / eq_buddy.rb
Last active January 3, 2016 19:09 — forked from KCErb/Subclass
class EQBuddy < Shoes
url '/', :begin_the_testing
def begin_the_testing
button "Begin the Testing!" do
alert "Hello EQBuddy"
end
end
end