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
// TiddlyWiki 5 code from Jeremy Ruston | |
// Gives you a jQuery object that you can set width and height on, just as if it was an IMG tag. | |
var svgDoc = new DOMParser().parseFromString(svgText, | |
"application/xml").documentElement; | |
fixSVG(svgDoc.childNodes,generateIdPrefix()); | |
img = $(document.importNode(svgDoc, true)); | |
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
function yoink(complete) { | |
var all={ | |
scripts: [], | |
stylesheets: [] | |
} | |
function downloadResources(urls, onComplete) { | |
var resources = []; |
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
#!/usr/bin/env python | |
# Quick edit of FND's http://github.com/FND/tiddlywebadmin/blob/master/spa.py | |
# mahemoff - added support for remote resources and uglied up RegExps to make them a # bit more general | |
""" | |
single-page app compiler | |
uses references to local JavaScript and CSS files and bakes their code into an | |
HTML5 document |
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
<!-- This is a Node+WebSocket powered demo to sync videos | |
across different browsers. This file is the client, | |
the other one is the Node server. Powered by Node and | |
http://github.com/miksago/node-websocket-server --> | |
<style> | |
.inactive { display: none; } | |
.active { display: block; } | |
</style> | |
<script> |
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
*** JS *** | |
var $twitbox = $("<div class='twitbox'/>") | |
.html("<div>Loading</div>") | |
.appendTo("#main-table .nav"); | |
var url = "http://twitter.com/status/user_timeline/techmeme.json?count=10&callback=?"; | |
$.getJSON(url, function(tweets) { | |
$twitbox.empty(); | |
$("<h3/>").html("@techmeme says").appendTo($twitbox); | |
$.each(tweets, function(i, tweet) { |
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
// ==UserScript== | |
// @name featuredapps | |
// @namespace http://mahemoff.com | |
// @include https://chrome.google.com/webstore/list/featured* | |
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js | |
// ==/UserScript== | |
function extract() { | |
var apps = GM_getValue("apps") || ""; | |
var category = $(".navi-path .navi-item a").eq(1).html(); |
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 pen = new Graphics(); // I find "graphics" vague, so I call it pen! | |
stage = new Stage(canvas); // the display | |
pen.setStrokeStyle(1).drawCircle(0,0,RADIUS); // not really drawn yet | |
circle = new Shape(g); /* AHA now we have an object for the thing we haven't yet really drawn | |
stage.addChild(circle); // Now it's drawn | |
// later on, we see the benefits of this cunning display | |
circle.x += 8; // | |
stage.update(); |
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 pen = new Graphics(); // I find "graphics" vague, so I call it pen! | |
stage = new Stage(canvas); // the display | |
pen.setStrokeStyle(1).drawCircle(0,0,RADIUS); // not really drawn yet | |
circle = new Shape(g); /* AHA now we have an object for the thing we haven't yet really drawn */ | |
stage.addChild(circle); // Now it's drawn | |
// later on, we see the benefits of this cunning display | |
circle.x += 8; // | |
stage.update(); |
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
#!/usr/bin/env ruby | |
# suck.rb index.html will build a local.index.html with all images offline | |
require 'httpclient' | |
### UTILITIES | |
Dir.mkdir('images') unless File.directory?('images') | |
def imagepath(url) | |
'images/' + url.sub('http://','').gsub('/','__') | |
end |
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
$.fn.copyTo = (target) -> { | |
src = $(this)[0] | |
$(target).each( () -> { | |
@.getContext("2d").drawImage(src, | |
0, 0, src.width, src.height, | |
0, 0, @.width, @.height | |
) | |
}) | |
} |