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
/* jquery.tinydb - jQuery interface to TinyDB (http://tinydb.org/) | |
* Copyright (c) 2008 Chris Moyer (chris@inarow.net) | |
* | |
* usage: | |
* jQuery.tinydb.read(tinydb_id, callback); | |
* callback is called with the data from TinyDB | |
* | |
* jQuery.tinydb.write({key: val, key2: val2}, callback); | |
* write data, callback is called with tinydb_id string | |
* |
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
/* minimal_modal.js - http://gist.github.com/215401 | |
* Copyright (c) 2009 Chris Moyer (chris@inarow.net) | |
* | |
* Usage: | |
* modal.open('some html'); // Open a modal | |
* modal.close(); // Close a modal | |
* | |
* No options or configuration. It's minimal. Take, edit, use. | |
* | |
* MIT (http://www.opensource.org/licenses/mit-license.php) licensed. |
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 'redcloth' | |
require 'net/http' | |
require 'uri' | |
user = 'your@email.here' | |
pass = 'thisisnotit' | |
url = URI.parse('http://www.tumblr.com/api/write') | |
ARGF.each do |f| |
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>Chris Moyer (Let's get our ducks in a row.)</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> | |
<meta name="description" content="Chris Moyer (CDMoyer) - Freelance Developer (PHP, Javascript, Perl, Ruby) in Buffalo, NY"> | |
<style type="text/css"> |
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
<!-- <head> if jquery isn't on the page already --> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> | |
<!-- <head>, another file, wherever --> | |
<script type="text/javascript"> | |
function tumblr(resp) { | |
var posts = resp.posts; | |
$('#blog .loading').replaceWith('<ul/>'); | |
$ul = $('#blog ul'); | |
for (var i=0; i<posts.length; i++) { |
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
// github gist linker | |
// Copyright (c) 2009, Chris Moyer (chris@inarow.net) http://inarow.net/ | |
// MIT (http://www.opensource.org/licenses/mit-license.php) licensed. | |
// | |
// | |
// ==UserScript== | |
// @name github gist linker | |
// @namespace http://inarow.net/ | |
// @include http://github.com/* | |
// @description Version 0.5 |
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 script = document.createElement('script'); | |
var code = "alert('foo');"; | |
try{ | |
script.appendChild(document.createTextNode(code)) | |
} catch(e) { | |
// IE | |
script.text = code; | |
} |
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
-- Lack of easy access to anything better than second resolution. Blah. | |
math.randomseed(os.time()) | |
-- Successive seeds of os.time() that are close end up creating the same | |
-- value on OSX due to the integer making or random(x,y) losing precision | |
math.randomseed(os.time() * math.random()) | |
local num = math.random(1e7,1e8) | |
while num ~= 1 do | |
str = "" .. num | |
if num % 2 == 0 then |
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
// Show Subcontext on scripting.com, highlight | |
// Copyright (c) 2010, Chris Moyer (chris@inarow.net) http://inarow.net/ | |
// MIT (http://www.opensource.org/licenses/mit-license.php) licensed. | |
// | |
// | |
// ==UserScript== | |
// @name Scripting.com Subcontext Opener | |
// @namespace http://inarow.net/ | |
// @include http://scripting.com/* | |
// @description Version 1.0 |
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
$chance = 30; | |
$total = 0; | |
$times = 0; | |
for ($i=0; $i<500000; $i++) { | |
$seen = 0; | |
for ($t = 0; $t<15; $t++) { | |
$roll = int(rand(100) + 1); | |
if ($roll < $chance) { $seen++; } | |
elsif (($t == 4 && $seen == 0) || ($t == 9 && $seen == 1) || ($t == 14 && $seen == 2)) { $seen++ ; } |
OlderNewer