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
<p>تخطيط العود</p> | |
<style type="text/css"> | |
p { direction: rtl; text-align: center; font: 24pt normal serif; width: 400px; } | |
div { float: left; height: 100px; border: solid 1px gray; border-right: none; } | |
</style> | |
<script type="text/javascript"> | |
// <div style="width: 3.3cm;"> </div> | |
var m = 1.059463094; //magic number | |
var a = 60; | |
var b = 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
alpha = "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890" | |
alpha[Math.round(Math.random() * 62)] |
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
from peewee import * | |
# assume environment variable CLEARDB_DATABASE_URL is set (true on Heroku if you have the cleardb addon) | |
url = urlparse.urlparse(os.getenv('CLEARDB_DATABASE_URL')) | |
dbname = url.path[1:url.path.index('?')] | |
db = MySQLDatabase(dbname, host=url.hostname, user=url.username, passwd=url.password) | |
# Now use db to connect to the database .. | |
class BaseModel(Model): |
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>{Title}</title> | |
<link | |
href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-combined.min.css" | |
rel="stylesheet"> | |
<meta name="text:LiveFyreSiteID" content=""/> | |
<link rel="shortcut icon" href="{Favicon}"> |
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
echo = function(areq) { console.log(areq.response) }; | |
requests = (function() { | |
var module = {}; | |
var AsyncRequest = XMLHttpRequest; | |
// takes a dict and returns a string "a=b&c=d" | |
var toUrlParams = function(dict) { | |
var res = []; | |
for(var key in dict) { |
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 fileinput | |
import re | |
import sys | |
``` | |
eg. [東京]{とうきょう} -> <ruby>東京<rp>(</rp><rt>とうきょう</rt><rp>)</rp></ruby> | |
``` | |
def furiganize(line): | |
# (?<!\\) means don't match if preceeded by a backslash | |
return re.sub(ur'(?<!\\)\[(.*?)\]\{(.*?)\}', ur'<ruby>\1<rp>(</rp><rt>\2</rt><rp>)</rp></ruby>', line.rstrip()) | |
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 random | |
def haiku(): | |
# originally from: https://gist.github.com/1266756 | |
# with some changes | |
# example output: | |
# "falling-late-violet-forest-d27b3" | |
adjs = [ "autumn", "hidden", "bitter", "misty", "silent", "empty", "dry", "dark", | |
"summer", "icy", "delicate", "quiet", "white", "cool", "spring", "winter", | |
"patient", "twilight", "dawn", "crimson", "wispy", "weathered", "blue", | |
"billowing", "broken", "cold", "damp", "falling", "frosty", "green", |
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
package esbuilder | |
import "os" | |
import "path" | |
import "fmt" | |
import "log" | |
import "time" | |
// the main hero! | |
import "github.com/evanw/esbuild/pkg/api" |
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 code is shared as-is. Use at your own risk. | |
It is not meant to be depended upon as a module. Instead, copy it to your own code base and make changes as needed. | |
CC0/MIT-0/Unlicense | |
It generates type definitions for structs and enums in Go to Typescript. | |
It's only meant to be executed locally; during development. |
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 * as refs from "./refs"; | |
class ById { | |
constructor(public param: any) { } | |
} | |
// wraps an object in a special flag so that the cache uses the object's id instead of hashing its keys and values | |
export function byId(param: any) { | |
return new ById(param) | |
} |
OlderNewer