Skip to content

Instantly share code, notes, and snippets.

View LinZap's full-sized avatar
🔬
copilot

Zap LinZap

🔬
copilot
View GitHub Profile
@LinZap
LinZap / to_fbirs.sql
Created March 28, 2016 07:50
FBI to FBIRS patch
drop view vd_run_se;
drop view vd_run_phrase;
drop view vd_run_entropy;
alter table token drop column run_se;
alter table token drop column run_phrase;
alter table token drop column run_entropy;
drop view v_post;
drop view vd_fballpost;
create or replace view vd_fballpost as
select o.oid,om.cname mname,m.name mfbid,o.type,o.cname,o.ename,o.cdes,o.edes,o.since,o.lastmodifydt,o.sourceurl,o.nclick,
@LinZap
LinZap / control.js
Last active April 11, 2016 14:33
Node.js static data - 猜猜看 index.js 最後印出什麼?
var d = require('./data');
module.exports = {
add: function(item){
d.data.push(item);
}
}
@LinZap
LinZap / changelog.md
Created April 14, 2016 21:38
v3.2 changelog

Change Log

這裡會記錄近幾版修改的細節與說明

V3.2

v3.2 將帶你進入全面的 ES6 世界!

New - 全新的初始歡迎頁面

原先的初始化面太醜,現已經改為較正式的歡迎畫面。

@LinZap
LinZap / 01 - Getting Started.md
Last active April 15, 2016 07:45
Lesson 1 - Getting Started

React 入門

在進入 React 開發的世界前,先確認你對於以下列的幾點有正確認知

  • 什麼是「前端」? 什麼是「後端」?
  • 知道下圖是什麼
    訪問網頁
  • 知道 Node.js 與瀏覽器上的 javascript 是有差的
  • 瞭解 DOM 是什麼
@LinZap
LinZap / gen.js
Created May 30, 2016 10:29
es6 generator teach
var request = require("request"),
fs = require("fs"),
cheerio = require("cheerio")
const url = "/wiki/%E5%A4%A7%E5%8D%AB%C2%B7%E4%BC%91%E8%B0%9F"
var p = []
var main_gen = (function*(){
@LinZap
LinZap / index.js
Last active December 2, 2016 02:08
Call other process use Node.js
const exec = require('child_process').exec
exec('py main.py', (error, stdout, stderr) => {
if(error)
console.log('print',stderr)
else
console.log('print',stdout)
})
@LinZap
LinZap / README.md
Last active July 19, 2016 01:48
React Sublime-text 3 snippets

Sublime-text 3 Snippets

以下是我自己開發 React 時覺得常用的語法,我會把它們寫成 Snippets,快速產生樣板後可以提升開發的速度。

Create Store Template

<snippet>
<content><![CDATA[
import { createStore, applyMiddleware } from 'redux'
import thunkMiddleware from 'redux-thunk'
@LinZap
LinZap / dupindex.sql
Created August 1, 2016 02:46
Dupindex
create table DupIndex
(
OID int not null,
TID int not null,
Rank int not null default(0),
Weight smallint default(1),
Field bit(16) not null default(0::bit(16)),
constraint dupindex_pkey primary key(OID, TID, Rank),
foreign key(OID) references Object(OID),
foreign key(TID) references Token(TID)
@LinZap
LinZap / README.md
Last active August 18, 2016 14:23
React + D3

淺談 React + D3

這邊簡單說明 React 如何無痛與 D3 結合

思路

主要的作法有兩種

  • 由 React 控制 svg 的 DOM 結構
  • D3 控制 svg 的 DOM 結構,但需要實做更新邏輯
@LinZap
LinZap / addphrase.sql
Last active August 19, 2016 21:13
Add Phrase
CREATE OR REPLACE FUNCTION addPhrase(_words varchar)
RETURNS integer AS
$BODY$
declare _tid int;_uid int;_r Object%rowtype;
_interfreq int:=0;_intrafreq int:=0;_weight int;
begin
_words:=lower(_words);
if not exists(select * from ud where words=_words) then
insert into ud(words) values(_words);
end if;