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 draw_line_between(ax, ay, bx, by) | |
{ | |
var comp_x = ax - bx | |
var comp_y = ay - by | |
var _angle = Math.atan(comp_y/comp_x)*180/Math.PI // Yes, I like my angles in degrees... | |
var _distance = Math.sqrt(Math.abs(comp_x*comp_x + comp_y*comp_y)) | |
var div = document.createElement("div") | |
var Dy = Math.cos((180-90-_angle)*(Math.PI/180))*(_distance/2); | |
var Dx = Math.sin((90-(180-_angle)/2)*(Math.PI/180))*Math.sin((_angle/2)*(Math.PI/180))*(_distance) | |
document.getElementsByTagName("body")[0].appendChild(div) |
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
; MathLayer.ahk | |
; Created by John Ankarström (jocap) | |
; Inspired by Steve Losh: http://stevelosh.com/blog/2012/10/a-modern-space-cadet/#math | |
; Compatible with US key layout | |
; Todo: Caps Lock support | |
; Issues: Selecting with LShift + arrow keys doesn't work great, RShift + arrow keys doesn't work at all | |
global MathMode := 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
import urllib, json | |
url = "http://%s.jaiku.com/contacts/feed/json" % username | |
params = {'user': username, 'personal_key': api_key} | |
result = urllib.urlopen(url, urllib.urlencode(params)).read() | |
data = json.loads(result) | |
title = data['title'] # Jaiku | Overview | |
# print timeline | |
for presence in data['stream']: |
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
# @app.rb | |
[...] | |
require "ruby_pagination_logic" | |
get '/page/:page' do |page| | |
@page = page.to_i | |
limit = 5 | |
offset = RPL::paginate @page, limit | |
@post = Post.all :limit => limit, :offset => offset, :order => 'date' |
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
$ (sudo) gem install ruby_pagination_logic |
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
require "dm-core" | |
require "dm-migrations" | |
# Configure DataMapper | |
DataMapper.setup(:default, ENV['DATABASE_URL'] || "sqlite3://database.db") | |
# model Article | |
class Article | |
include DataMapper::Resource | |
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
get '/archive' do | |
@articles = Article.all :limit => 10, :order => 'created_at' | |
erb :articles # or haml, whatever | |
end | |
get '/archive/:permalink' do |permalink| | |
@article = Article.first :permalink => permalink | |
erb :article | |
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
def text(text, htmloutput = true) | |
if htmloutput | |
return text.rm_ln | |
else | |
return text.rm_ln! | |
end | |
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
$ (sudo) gem install dm-core dm-migrations |
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 off | |
set /a c=1 | |
setlocal ENABLEDELAYEDEXPANSION | |
for /f "usebackq delims=|" %%f in (`dir /b "E:\Documents\ArmA 2 Other Profiles\JohnAJ\missions"`) do ( | |
set files[!c!]=%%f | |
echo !c!, %%f | |
set /a c+=1 | |
) |
OlderNewer