Skip to content

Instantly share code, notes, and snippets.

View chalkers's full-sized avatar

Andrew Chalkley chalkers

  • Portland, OR, USA
View GitHub Profile

Keybase proof

I hereby claim:

  • I am chalkers on github.
  • I am chalkers (https://keybase.io/chalkers) on keybase.
  • I have a public key whose fingerprint is 1A3B 9A4A AB3C 9636 D73A A892 7F7E 82FA AF1F 77A2

To claim this, I am signing this object:

var state = "smile";
var express = require('express');
var app = express();
var http = require('http').Server(app);
var io = require('socket.io')(http);
app.use(express.static('public'));
@chalkers
chalkers / gist:7818873
Last active December 30, 2015 10:49 — forked from mwhuss/gist:7818698
"intensity" : "20",
"vectors" : "1",
"worksize" : "256",
"kernel" : "scrypt",
"lookup-gap" : "2,2",
"thread-concurrency" : "24000",
"shaders" : "0,0",
"gpu-engine" : "0-1085",
"gpu-fan" : "0-100",
"gpu-memclock" : "1375",
@chalkers
chalkers / basic_library.ino
Last active December 19, 2015 18:38
Which is better?
#include <DigitalPin.h>
DigitalPin forward(13);
DigitalPin backward(12);
void setup(){
}
void loop() {
backward.off();
@chalkers
chalkers / gist:1435273
Created December 5, 2011 20:47
Face Detection
//Have a UIImage *image
NSDictionary *detectorOptions = [[NSDictionary alloc] initWithObjectsAndKeys:CIDetectorAccuracyHigh, CIDetectorAccuracy, nil];
CIDetector *faceDetector = [CIDetector detectorOfType:CIDetectorTypeFace context:nil options:detectorOptions];
CIImage *ciImage = [CIImage imageWithCGImage:[image CGImage]];
NSArray *features = [faceDetector featuresInImage:ciImage];
@chalkers
chalkers / HTMLToMarkdown.js
Created February 22, 2011 06:12
Pass in a jQuery representation of an element ($container) you get markdown out.
function htmlToMarkdown($container) {
var $clone = $container.clone();
$("*",$clone).removeAttr("name").removeAttr("title").removeAttr("id")
var html = $clone.html();
html = standardiseHTML(html);
html = html.replace(/<a [^h]*href=["']([^"']*)["'][^>]*>([^<]*)<\/a>/gi, " [$2]($1)");
html = html.replace(/<em[^>]*>([^<]*)<\/em>/gi,"*$1*");
html = html.replace(/<strong[^>]*>([^<]*)<\/strong>/gi,"**$1**");
html = html.replace(/<i[^>]*>([^<]*)<\/i>/gi,"*$1*");
html = html.replace(/<b[^>]*>([^<]*)<\/b>/gi,"**$1**");
rails testing_deployed_app
cd testing_deployed_app
ruby script/generate cucumber --rspec --capybara
#In features/support/env.rb add
Capybara.current_driver = :selenium
Capybara.app_host = 'http://news.bbc.o.uk'
rake db:migrate
validates_format_of :email, :with => /^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}/i
validates_format_of :website, :with => /^http:\/\//
module Rack
class UDPLoggerThingy
def initialize app, options = { }
@app = app
end
def call env
status, headers, body = @app.call(env)
#Do shit here
#http://rack.rubyforge.org/doc/classes/Rack/Request.html
Scenario: Ordering
And I follow "Archive"
Then I should see the following div with id archive results:
|Article Evolution and Biology Title TAGGED: BIOLOGY, EVOLUTION|
|Article Biology Only Title TAGGED: BIOLOGY |
|Article Evolution Only Title TAGGED: EVOLUTION |
When I follow "Article Biology Only Title"
And I fill in "Content" with "This comment should be long enough!"
And I press "Create Comment"
And I follow "Archive"