Skip to content

Instantly share code, notes, and snippets.

View audreyt's full-sized avatar

唐鳳 audreyt

View GitHub Profile
@audreyt
audreyt / apply.sql
Last active October 6, 2016 13:14
plv8 SQL for the |> and <| operators (aka LiveScript application): SELECT '{"hello": [1,2,3]}' |> 'this.hello[0]'; SELECT 'this.hello[0]' <| '{"hello": [1,2,3]}';
CREATE OR REPLACE FUNCTION plv8x.json_eval(code text) RETURNS plv8x.json AS $$
return JSON.stringify(
eval("(function(){return #code})").apply(this)
);
$$ LANGUAGE plls IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION plv8x.json_eval(data plv8x.json, code text) RETURNS plv8x.json AS $$
return JSON.stringify(
eval("(function(){return #code})").apply(JSON.parse(data))
);
$$ LANGUAGE plls IMMUTABLE STRICT;
#!/usr/bin/env node
var threadCount = 4;
var threadPool = require('webworker-threads').createPool(threadCount);
threadPool.load('gistfile2.js');
threadPool.all.emit('init');
threadPool.on('message', function threadMessage(data) {
console.log(this.id + ': ' + data);
@audreyt
audreyt / private.ls
Created April 30, 2013 16:14
Private instance variable in LiveScript
class Container
->
secret = 3
@dec = ->
return false unless secret > 0
return secret--
x = new Container
console.log x.dec!
console.log x.dec!
/**
* Conway's Game of Life, in LiveScript
* ====================================
*
* Conway's Game of Life is a cellular automaton, published by John H Conway
* in 1970, fulfilling the design principles but greatly simplifying the
* research of von Neumann, into a hypothetical machine that could build
* copies of itself. It is a zero-player game, meaning there is no input, and
* the game will progress on its own with a 'seed', or configuration, to
* begin with.
@audreyt
audreyt / plv8.rb
Created May 15, 2013 08:03
PLV8 homebrew formula
require 'formula'
class Plv8 < Formula
homepage 'http://code.google.com/p/plv8js/wiki/PLV8'
version '1.4.1'
url 'https://plv8js.googlecode.com/files/plv8-1.4.1.zip'
sha1 'ceb7579b1fae1c1fe795c03a23471fdf9c7c469e'
head 'https://code.google.com/p/plv8js/', :using => :git
@audreyt
audreyt / postgresql-9.3.diff
Created May 15, 2013 08:13
Pg93 for homebrew
diff --git a/Library/Formula/postgresql.rb b/Library/Formula/postgresql.rb
index d1a2e77..da1c030 100644
--- a/Library/Formula/postgresql.rb
+++ b/Library/Formula/postgresql.rb
@@ -2,9 +2,11 @@ require 'formula'
class Postgresql < Formula
homepage 'http://www.postgresql.org/'
- url 'http://ftp.postgresql.org/pub/source/v9.2.4/postgresql-9.2.4.tar.bz2'
- sha1 '75b53c884cb10ed9404747b51677358f12082152'

淡入 一群身著制服,表情嚴肅的軍官。)

會議桌的主位上,一位資深高階 將軍 正在說話。

將軍:報告已經證實了,紐約市已經…被殭屍占領了。

上校:又來了?明明 28 天前才發生過一次殭屍入侵!

將軍:這些僵屍…不一樣。它們是… 哲學 僵屍。

@audreyt
audreyt / mps.html
Created August 10, 2013 10:18
Experimental MPS layout
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html lang="zh-hant-TW" class="han-biaodian-pro han-la">
<head id="Head1"><meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>你敢有聽著咱的歌 Lí kám-ū thiann-tio̍h lán-ê kua</title>
<base target="moedict">
<link rel="stylesheet" href="han.css">
<link rel="stylesheet" href="style.css">
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>

Opening

Many of you, like me, have taken to the streets more than once this year.

At the end of last year, a series of events caused considerable concern over the deterioration in the state of democracy in Taiwan. As a result, a group of friends who work in the IT industry founded a movement called “g0v.tw” — “0” as in “007.”

The goal of g0v is to improve information transparency in the government. Using modern technology, we aim to transform society and ensure that its citizens are both heard and seen.

To have a voice, we organized a large amount of data, wrote many lines of code and built websites, so that the public can gain a deeper understanding about various issues and become more willing to participate in such matters. Why do we want to stay in front of the computer all day, instead of going out and having fun?

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.