Skip to content

Instantly share code, notes, and snippets.

@hasenj
hasenj / text-only-tumblr-theme.html
Last active December 16, 2015 00:19
Clean Tumblr theme that only supports Text and Link posts, with LiveFyre for comments. Uses bootstrap and a few fonts from Google Web Fonts. Includes support for automagically fixing Arabic text to run from right-to-left.
<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}">
@hasenj
hasenj / peewee_cleardb.py
Created April 6, 2013 15:47
Connect to a ClearDB database via the peewee ORM
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):
@hasenj
hasenj / random_alphanum.js
Created September 7, 2012 03:38
random alphanum in javascript
alpha = "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890"
alpha[Math.round(Math.random() * 62)]
@hasenj
hasenj / oud-lines.html
Created February 6, 2011 02:24
تخطيط العود .. افتح الملف في المتصفح و اطبعه
<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;">&nbsp;</div>
var m = 1.059463094; //magic number
var a = 60;
var b = a;