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
// Useful for browser console operations ala Firebug or Chrome Dev Tools | |
// http://techrageo.us/2008/03/05/jquery-for-firebug/ | |
j=document.createElement("SCRIPT"); | |
j.src="http://code.jquery.com/jquery-latest.pack.js"; | |
document.getElementsByTagName("HEAD")[0].appendChild(j); |
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
open System.Text | |
open System.IO | |
open System.Net | |
open System.Web | |
let auth = | |
let URL = "https://www.google.com/accounts/ClientLogin" | |
let webRequest = HttpWebRequest.Create(URL) | |
webRequest.Method <- "POST" | |
webRequest.ContentType <- "application/x-www-form-urlencoded" | |
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
GetWebRequestHelper (url:string) = | |
let req = HttpWebRequest.Create(url) | |
req.Headers.Add("Authorization: GoogleLogin auth=" + auth) | |
let response = req.GetResponse() | |
let responseStream = response.GetResponseStream() | |
let sr = new StreamReader(responseStream) | |
sr.ReadToEnd() |
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
open System.Net | |
let getHttpContents (url:string) = async { | |
let req = WebRequest.Create(url) | |
let! response = req.AsyncGetResponse() | |
use stream = response.GetResponseStream() | |
use streamreader = new System.IO.StreamReader(stream) | |
let contents = streamreader.ReadToEnd() | |
return contents | |
} |
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
// ASSUMPTION: jQuery is already loaded on the GitHub home page | |
// ASSUMPTION: Your username is TheDahv ;) | |
// JQUERY, I SUMMON YOU TO DO MY BIDDING WITH THIS HORRENDOUS ONE-LINER (FORMATTED FOR CONVENIENCE!!!) | |
$.get('https://github.com/TheDahv/following', | |
function (data) { | |
var members = $(data).find('.members > li').map(function(i,m) { return m.children[0].getAttribute('href').replace(/\//,""); }); | |
$('.news > div.alert').each( | |
function(i,a) { | |
var title = a.children[0].children[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
<html> | |
<head> | |
<title>Scalable Image Test</title> | |
<style type="text/css"> | |
body { | |
/* Background image rules */ | |
background-attachment: fixed; | |
background-color: #333; | |
background-image: url(../img/bgimg.png); | |
background-position: top right; |
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 groupedByWeek = new List<DateTime> { | |
new DateTime(2012, 02, 01), | |
new DateTime(2012, 02, 02), | |
new DateTime(2012, 02, 06), | |
new DateTime(2012, 02, 13) | |
}. | |
GroupBy(s => s.DayOfYear / 7). | |
ToDictionary( | |
s => (new DateTime(2012, 01, 01).AddDays((s.First().DayOfYear / 7) * 7)), | |
s => s.Count() |
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
// wrapped in anonymous function to protect against | |
// leaks to global NS | |
(function () { | |
// Factory to create objects | |
var make_thing = function (initial_value) { | |
var thing = that = {}; | |
thing.value = initial_value; | |
thing.dosomething = function () { | |
return that.value; // 'that' is 'closed over' |
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
# node -v => v0.6.13 | |
# npm -v => 1.1.9 | |
# python (IronPython) -v => IronPython 2.7.1 (2.7.0.40) on .NET 4.0.30319.17379 | |
PS C:\Applications\node\js-browser-automation> npm install jsdom | |
npm http GET https://registry.npmjs.org/jsdom | |
npm http 304 https://registry.npmjs.org/jsdom | |
npm http GET https://registry.npmjs.org/cssom | |
npm http GET https://registry.npmjs.org/contextify | |
npm http GET https://registry.npmjs.org/request |
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
namespace FSharpTemplate | |
module Template = | |
type HtmlElement = | |
| Html of HtmlElement list | |
| Head of HtmlElement list | |
| Title of string | |
| Body of HtmlElement list | |
(* id, class, children *) | |
| Div of string * string * HtmlElement list |
OlderNewer