This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// one way | |
function getUrlVars() { | |
var vars = {}; | |
var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) { | |
vars[key] = value; | |
}); | |
return vars; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Very small re-usable tabbifying jquery plugin , @roxxypoxxy | |
// Usage | |
/** | |
The list | |
<ul class="my-tabs"> | |
<li rel="div1">Div One</li> | |
<li rel="div2">Div Two</li> | |
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'csv' | |
csv = CSV::parse(File.open(path_to_file, 'r') {|f| f.read }) | |
fields = csv.shift | |
csv.collect { |record| Hash[*(0..(fields.length - 1)).collect {|index| [fields[index],record[index].to_s] }.flatten ] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data:text/html, <style type%3D"text%2Fcss">%23e{position%3Aabsolute%3Btop%3A0%3Bright%3A0%3Bbottom%3A0%3Bleft%3A0%3B}<%2Fstyle><div id%3D"e"><%2Fdiv><script src%3D"http%3A%2F%2Fd1n0x3qji82z53.cloudfront.net%2Fsrc-min-noconflict%2Face.js" type%3D"text%2Fjavascript" charset%3D"utf-8"><%2Fscript><script>var e%3Dace.edit("e")%3Be.setTheme("ace%2Ftheme%2Fmonokai")%3Be.getSession().setMode("ace%2Fmode%2Fruby")%3B<%2Fscript> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'capybara' | |
require 'capybara/dsl' | |
Capybara.run_server = false | |
Capybara.current_driver = :selenium | |
Capybara.app_host = 'http://...' | |
module MyCapybara | |
class FireBro | |
include Capybara::DSL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'capybara' | |
require 'capybara/dsl' | |
require 'pry' | |
require 'yaml' | |
require 'json' | |
require "net/http" | |
require "uri" | |
Capybara.run_server = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EventMachine.run do | |
EM::WebSocket.start(:host => "0.0.0.0", :port => 8080, :debug => false) do |ws| | |
ws.onopen do | |
ws.onmessage { |data| | |
# ... | |
# ws.send | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ws = new WebSocket("ws://localhost:8080/"); | |
ws.onopen = function() { | |
this.send(JSON.stringify({event: "init",data: { c_wid: "51396e790662720c10000002" } })); | |
}; | |
ws.onmessage = function(evt){ | |
var json = JSON.parse(evt.data); | |
console.log(json); | |
this.dispatch(json.event, json.data); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String.prototype.toHHMMSS = function () { | |
sec_numb = parseInt(this); | |
var hours = Math.floor(sec_numb / 3600); | |
var minutes = Math.floor((sec_numb - (hours * 3600)) / 60); | |
var seconds = sec_numb - (hours * 3600) - (minutes * 60); | |
if (hours < 10) {hours = "0"+hours;} | |
if (minutes < 10) {minutes = "0"+minutes;} | |
if (seconds < 10) {seconds = "0"+seconds;} | |
var time = hours+':'+minutes+':'+seconds; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Google Developers</title> | |
<link rel="stylesheet" type="text/css" href="/_static/css/screen.css" /> | |
<link rel="stylesheet" href="//www.google.com/cse/style/look/default.css" type="text/css" /> | |
<link href='http://fonts.googleapis.com/css?family=Open+Sans:300,400' rel='stylesheet' type='text/css'> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script> | |
<script id="jqueryui" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.10/jquery-ui.min.js" defer async></script> | |
<!--[if lt IE 9]> |