Skip to content

Instantly share code, notes, and snippets.

View LinZap's full-sized avatar
🔬
copilot

Zap LinZap

🔬
copilot
View GitHub Profile
@LinZap
LinZap / gist:6fe650ec04e319897ac0
Created January 18, 2015 14:46
jQuery plugin - score bot
// var js = document.createElement('script');
// js.src="//code.jquery.com/jquery-1.11.2.min.js";
// document.body.appendChild(js);
$('.c2:eq(0)').remove();
var s = "999999999 80 wefnwefwiefwiuefewuf 999999999...";
var c2 = $('.c2');
var sp = s.split(" ");
for(var i=0;i<sp.length;i++){
var sk = sp[i].split(" ");
var k = sk[0].trim();
@LinZap
LinZap / write_a_word.js
Last active August 29, 2015 14:14
Write a word on Canvas
var canvas = document.getElementById('st');
var pen = canvas.getContext('2d');
pen.drawImage(document.getElementById('img'),0,0);
var x,y;
var x1, x2, y1, y2;
var scale = 5;
var worddata = [];
$.ajax({url: 'word.xml',dataType: 'xml'}).done(function(xml) {
<div class="header" ejs="views/fbi-header"></div>
<div class="content">
<div class="fbi-pagebox" >
<div class="page">
<div class="content-overview">
<div ejs="views/article-category-header"></div>
<div ejs="@bulid_tabbox" class="content-detail"></div>
</div><!--
// EJS 中: <div ejs="@bulid_urlitem"> </div>
// tar 會從外部傳 該 tag 近來
function bulid_urlitem(tar){
var cid = tar.attr('cid');
api({did:4,cid:cid,limitnum:9},function(data){
render({
ejs:'views/urlitem',
data:data,
//這裡直接告訴 ejs 把畫面放進這個 div
var query = require('pg-query');
query.connectionParameters = 'postgres://postgres:postgres@10.10.59.116:5432/fba_db';
var i=10;
//accepts optional array of values as 2nd parameter for parameterized queries
var promise;
q();
function onSuccess(rows, result) {
@LinZap
LinZap / a.json
Last active August 29, 2015 14:19
test json
{"item": [{"cid": "5","pcname": "粉絲專頁","ccid": "13","ccname": "日不落食堂 - 日本料理","type": "29","cdes": "日不落食堂 消費方式 現點現做 無限量續點 桌邊服務 會 另有定食丼飯及 單點計費方式 現正優惠中","since": "2015-03-10 231605.884797","rank": null,"cover": "https://fbcdn-sphotos-d-a.akamaihd.net/hphotos-ak-xpf1/v/t1.0-9/s720x720/1798371_858016984242657_9186016283299968654_n.jpg?oh=e27ee773bbfce540d9af9390f9df171f&oe=557E26F6&__gda__=1434773617_6c348b9fd83cb32d31a73d57feb96f2b","fbid": "304633632914331","likenum": "1030"},{"cid": "5","pcname": "粉絲專頁","ccid": "12","ccname": "金泰日本料理","type": "29","cdes": null,"since": "2015-03-10 231554.603326","rank": null,"cover": null,"fbid": "111841048892618","likenum": "3899"},{"cid": "5","pcname": "粉絲專頁","ccid": "10","ccname": "花太郎日本料理","type": "29","cdes": "花太郎日本料理 精緻-美味-平價- 嚴選高級食材,做出幸福料理","since": "2015-03-10 222328.41024","rank": null,"cover": "https://scontent.xx.fbcdn.net/hphotos-xpa1/t31.0-8/s720x720/10714426_729678507102650_2573998765299508705_o.jpg","fbid": "444688202268350","likenum": "9880"},{"cid": "5","pcname
@LinZap
LinZap / waterfall.js
Created April 23, 2015 22:29
Waterfall JS
/**
* Copyright 2015, Zap Lin
* All rights reserved.
*
* This source code is licensed under the Apache license found in the
* LICENSE file in the root directory of this source tree.
*/
(function($){
// 矩陣相加
var plus = function(arr1,arr2){
var res = matrix(arr1.length,arr1[0].length);
if(typeof arr2==="number"){
for(var i=0;i<arr1.length;i++)
for(var j=0;j<arr1[0].length;j++)
res[i][j] = arr1[i][j]+arr2;
}
else{
@LinZap
LinZap / zapejs.js
Created October 27, 2015 21:20
EJS by Zap
/*
I3S-Awesome V3.0
Render System
@Zap
*/
(function(){
UI = {};
@LinZap
LinZap / selenium-scrollToEnd.js
Last active November 7, 2015 23:42
scroll to end and save web source
var webdriver = require('selenium-webdriver'),
By = require('selenium-webdriver').By,
until = require('selenium-webdriver').until,
fs = require('fs');
// keyword
var keyword = "不是鐵馬";
// open chrome
var driver = new webdriver.Builder().withCapabilities(webdriver.Capabilities.chrome()).build();