This file contains hidden or 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 "cocoa" | |
local filename = arg[1] | |
if not filename then | |
return | |
end | |
local ishtml = false | |
if filename:match("%.html$") then | |
ishtml = true |
This file contains hidden or 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
local assert,error,setmetatable,tonumber = assert,error,setmetatable,tonumber | |
local table = require "table" | |
local io = require "io" | |
local lxp = require "lxp" | |
local base64 = require "base64" | |
module "propertylist" | |
array_metatable = {} | |
dictionary_metatable = {} |
This file contains hidden or 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 CSSMatrix; | |
if (navigator.userAgent.indexOf("Gecko") !== -1 && navigator.userAgent.indexOf("KHTML") === -1) { | |
CSSStyleDeclaration.prototype.__defineGetter__("borderRadius",function() { | |
return this.MozBorderRadius; | |
}); | |
CSSStyleDeclaration.prototype.__defineSetter__("borderRadius",function(x) { | |
this.MozBorderRadius = x; | |
}); | |
CSSStyleDeclaration.prototype.__defineGetter__("userSelect",function() { |
This file contains hidden or 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
/* | |
bind1 :: (a -> b) -> a -> b | |
bind1 f t0 = f t0 | |
*/ | |
template<typename R, typename F, typename T0> | |
struct bind1_impl { | |
bind1_impl(F f,T0 t0):f(f),t0(t0){} | |
template<typename... T> | |
R operator()(T... t) { | |
return static_cast<R>(f(t0, t...)); |
This file contains hidden or 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
// gcd a b | a`mod`b == 0 = b | |
// | otherwise = gcd b (a`mod`b) | |
#define GCD(a,b) (GCD1((a),(b))) | |
#define GCD1(a,b) a%b==0?b:GCD2(b,(a%b)) | |
#define GCD2(a,b) a%b==0?b:GCD3(b,(a%b)) | |
#define GCD3(a,b) a%b==0?b:GCD4(b,(a%b)) | |
#define GCD4(a,b) a%b==0?b:GCD5(b,(a%b)) | |
#define GCD5(a,b) a%b==0?b:GCD6(b,(a%b)) |
This file contains hidden or 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
#include <cstdio> | |
class Foo | |
{ | |
int x; | |
public: | |
Foo(int x); | |
~Foo(); | |
void greet(); | |
}; | |
Foo::Foo(int x) : x(x) |
This file contains hidden or 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
interface Sum<A,B> | |
{ | |
elim<C>(left: (value: A) => C, right: (value: B) => C): C; | |
} | |
function Left<A>(value: A): {elim<C>(left:(value:A)=>C,right:(value:any)=>C):C;} | |
{ | |
return { | |
elim: <C>(left: (value: A) => C, right: (value: any) => C) => left(value) | |
}; | |
} |
This file contains hidden or 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 qualified Codec.Binary.QRCode as Q -- from `qrcode' package | |
import qualified Codec.Picture as P -- from `JuicyPixel' package | |
import qualified Codec.Picture.Png as P | |
import qualified Data.ByteString.Lazy as B | |
import Data.Array (Array,bounds,(!)) | |
pixelPerCell = 5 | |
main :: IO () | |
main = do l <- getLine |
This file contains hidden or 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 qualified Data.QRCode as Q -- from `haskell-qrencode' package | |
import qualified Codec.Picture as P -- from `JuicyPixels' package | |
import qualified Codec.Picture.Png as P | |
import qualified Data.ByteString.Lazy as B | |
pixelPerCell = 5 | |
main :: IO () | |
main = do l <- getLine | |
let version = Nothing -- auto |
This file contains hidden or 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 Reminders = Application("Reminders"); | |
function performMailActionWithMessages(messages) | |
{ | |
messages.forEach(function (message) { | |
var content = message.content(); | |
var r = /返却期限日\(Due Date\):(\d+)\/(\d+)\/(\d+)\nタイトル \(Title\):\n(.*)/g; | |
var m; | |
while (m = r.exec(content)) { | |
var year = parseInt(m[1]); |
OlderNewer