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
/* | |
import flash.display.*; | |
import flash.utils.*; | |
import mx.graphics.codec.*; | |
*/ | |
var bitmap:BitmapData = new BitmapData(128, 128, true); | |
var x:int, y:int; | |
for (y = 0; y < bitmap.height; y++) { | |
for (x = 0; x < bitmap.width; x++) { |
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 alpha:Number = 0.5; | |
var bitmap1:BitmapData = new BitmapData(100, 100, true, 0xffff0000); | |
var bitmap2:BitmapData = new BitmapData(100, 100, true, 0xff0000bb); | |
// draw with transparency | |
var transform:ColorTransform = new ColorTransform(1, 1, 1, alpha); | |
bitmap1.draw(bitmap2, null, transform); |
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 pre_forecast=0;window.setInterval(function(){var now=new Date();var h=now.getHours();var m=now.getMinutes();while(String(h).length<2){h='0'+h;}while(String(m).length<2){m='0'+m;}var forecast=Math.round(parseFloat($(".totalcontributed").text().replace(",",""))/(60-(new Date(timing.end*1000)-now)/1000/60/60)*60*100)/100;console.info(h+':'+m,forecast,((forecast-pre_forecast>0)?'+':'')+Math.round(forecast-pre_forecast));pre_forecast=forecast;},1000*60); |
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
<?php | |
function find_urls_url_callback($matches) { | |
if(strpos($matches[0], '<') !== false) { | |
return $matches[0]; | |
} | |
if(strpos($matches[0], '://') === false) { | |
return "<a class=\"url\" href=\"http://$matches[0]\">$matches[0]</a>"; | |
} | |
return "<a class=\"url\" href=\"$matches[0]\">$matches[0]</a>"; |
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
import urllib.request, urllib.parse, urllib.error | |
import math | |
# change os_url & file_base_url if you aren't on a Windows PC | |
server_url_base = "http://commondatastorage.googleapis.com/chromium-browser-snapshots/" | |
os_url = "Win/" # "Mac/" | |
file_base_url = "/chrome-win32.zip" # "/chrome-mac.zip" | |
latest_url = server_url_base + os_url + "LAST_CHANGE" |
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 foobar = {}; | |
var name1 = "test-foo-bar"; | |
var name2 = "test-bar-foo"; | |
var addObject = function(parts, object, value) { | |
if (parts.length <= 0) | |
return value; | |
if (!object[parts[0]]) | |
object[parts[0]] = {}; | |
object[parts[0]] = addObject(parts.slice(1), object[parts[0]], value); | |
return object; |
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> | |
<meta charset="utf-8"> | |
<title>Namen</title> | |
<style> | |
body { | |
background: #8f1; |
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 appendToOnload (callback) { | |
if (typeof window.onload !== "function") { | |
window.onload = callback; | |
return; | |
} | |
var formerCallback = window.onload; | |
window.onload = function () { | |
formerCallback(); |
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 getPixel (x, y) { | |
var pixels = Picture.getPixel(x, y), | |
red = pixels[0], | |
green = pixels[1], | |
blue = pixels[2]; | |
if (red > 128) { | |
red /= 2; | |
red += Math.random() * 0x33; | |
} else { |
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
import re | |
import requests | |
from prettytable import PrettyTable | |
from pyquery import PyQuery as pq | |
url = "http://www.apple.com/" | |
p = re.compile(r'\W+') | |
r = requests.get(url) | |
document = pq(r.text) |