Skip to content

Instantly share code, notes, and snippets.

<?php
class Yql extends Controller {
function __construct()
{
parent::Controller();
$this->load->library('yql_lib');
}
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
// include OAuth lib
require("OAuth.php");
class yql_lib{
function __construct(){
// define your consumer key
$this->consumerKey = "";
@kulor
kulor / Tabbable.rb
Created February 29, 2012 14:45
Find out if an element can be navigated to using the tab key
module Tabbable
def tagNames
['a', 'button', 'input', 'select', 'textarea', 'object']
end
def selectors
['tabindex']
end
def tabbableCssExpression
@kulor
kulor / proxyConfig.rb
Created February 29, 2012 14:46
Set a Capybara proxy using the http_proxy env
if ENV['TARGET_ENV'] && ENV['http_proxy'] && !ENV['http_proxy'].empty?
proxy = URI.parse(ENV['http_proxy'])
if Capybara.current_session.driver.respond_to?('agent') # mechanize only
Capybara.current_session.driver.agent.set_proxy(proxy.host, proxy.port)
puts "Using proxy #{proxy.host} #{proxy.port} from env"
end
end
@kulor
kulor / flip.html
Created April 24, 2012 14:16
CSS 3d Flip experiment
<!doctype html>
<html lang="en-us" dir="ltr" class="no-js">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>CSS Flip Experiment</title>
<style type="text/css">
.panel {
float: left;
width: 300px;
height: 300px;
{
"color_scheme": "Packages/Color Scheme - Default/Blackboard.tmTheme",
"dictionary": "Packages/Language - English/en_GB.dic",
"font_face": "Monaco",
"font_size": 17.5,
"tab_size": 4,
"detect_indentation": false,
"translate_tabs_to_spaces": true,
"spell_check": true
}
@kulor
kulor / async.js
Created May 8, 2012 11:55
Send off multiple http requests and deal with response
var async = require('async'); // npm install async
async.parallel({
foo: function(callback){
http.get({host:'localhost', port:9999, path:'/foo'}, function (res) {
res.on('data', function (data) {
callback(null, JSON.parse(data.toString()));
});
})
},
bar: function(callback){
@kulor
kulor / move_files.sh
Created May 23, 2012 10:22
Change a list of filenames
for i in `find *.png`; do echo mv $i `echo $i | sed 's/\([0-9]*\).*\.png/\1.png/'`; done
@kulor
kulor / .jshintrc
Created July 13, 2012 09:13
My JSHint preferences
{
"predef": [
"define",
"require"
],
"es5" : false,
"browser" : true,
"boss" : false,
"curly": true,
@kulor
kulor / dropshadow-ie7.css
Created August 3, 2012 13:32
ie image dropshadow support
/*
Dropshadow handling in IE vs. native box-shadow support
- Normal box-shadow on .dropshadow
/////////////////////
/ +===============+ /
/ | | /
/ | | /
/ | | /