Skip to content

Instantly share code, notes, and snippets.

View c9s's full-sized avatar

c9s

  • Taipei, Taiwan
  • 04:29 (UTC +08:00)
  • X @c9s
View GitHub Profile
@c9s
c9s / GoogleSpreadSheetInviteToSlack.js
Last active August 29, 2015 14:20
InviteToSlack from Google SpreadSheet
/*
The original script: https://github.com/dherbst/slack-invite-script/blob/master/code.js
*/
/*
Get channels from: curl 'https://golang.slack.com/api/channels.list?token={token}' | json_pp
*/
function getInviteChannels() {
return ['C123123123'];
@audreyt
audreyt / rot.ls
Created December 7, 2012 15:26
ROT encode/decode
#!/usr/bin/env lsc
# 使用前請先 curl -O http://cpansearch.perl.org/src/DANKOGAI/Unicode-Unihan-0.04/srctxt/Mandarin.txt
require! fs
c2p = {}; p2c = {}
for l in "#{fs.read-file-sync 'Mandarin.txt'}" / /\n/
[code, pin] = l / /\s+/
continue unless code is /^....$/ # BMP
09:07 -!- Irssi: Join to #webconf.tw was synced in 133 secs
09:08 < MouseMs> 大家早安
09:08 < locy69> 早安
09:09 < StarNight> 早安!~
09:10 < MouseMs> [SITCON] 答案填寫單將於9:30開放submit答案 PS:同時也會開放第五題唷 今天的題目都比較簡單 歡迎大家挑戰:)
09:13 < bency> 早安
09:13 < BeataLin> 早安!
09:21 < SITCON> 今天也有3題等著大家挑戰唷^^
09:23 < kikiqqp_> 今天R0的有線網路有點怪怪的
09:25 < ChAndrew> Good Morning!!
@nikic
nikic / guestbook.markdown
Created July 29, 2012 14:21
Quick doesn't have to mean dirty: Also applies to PHP!

Quick doesn't have to mean dirty: Also applies to PHP!

This is just a quick response to http://me.veekun.com/blog/2012/07/28/quick-doesnt-mean-dirty/. I won't bother to write a proper blog post for this, so a Gist will have to do ;)

When I read that article, one thing really striked me: If you want to quickly create a web app in PHP, you do exactly the same. I mean, exactly.

I never used the Silex microframework before, so I took this as a chance to see how it works. I'll just do the same as eevee did, only with a bit less commentary (this is a Gist after all!)

I hope that this will show you that PHP and Python are really similar to work with. Also this should show that just because you're using PHP, doesn't mean that you write dirty code. The similarity in the process and code is really incredible :)

@lancejpollard
lancejpollard / paginator.html
Created June 26, 2011 18:11
Semantic Pagination HTML5
<nav class='paginator' role='toolbar'>
<ul class='goto-pages'>
<li class='goto-search'>
<a href="#search" class="search-pages" title="Toggle Advanced Search">&#8981;</a>
</li>
<li class='goto-page'>
<a href="/admin/users?page=1" aria-disabled="true" class="first-page disabled" data-page="1" rel="first" title="Go to the first page">&#8676;</a>
</li>
<li class='goto-page'>
<a href="/admin/users?page=1" aria-disabled="true" class="prev-page disabled" data-page="1" rel="prev" title="Go to page 1">&#8672;</a>
@yorkxin
yorkxin / avoid-jquery-when-possible.md
Created July 7, 2012 13:04
Avoid jQuery When Possible

Avoid jQuery When Possible

jQuery does good jobs when you're dealing with browser compatibility. But we're living in an age that fewer and fewer people use old-school browsers such as IE <= 7. With the growing of DOM APIs in modern browsers (including IE 8), most functions that jQuery provides are built-in natively.

When targeting only modern browsers, it is better to avoid using jQuery's backward-compatible features. Instead, use the native DOM API, which will make your web page run much faster than you might think (native C / C++ implementaion v.s. JavaScript).

If you're making a web page for iOS (e.g. UIWebView), you should use native DOM APIs because mobile Safari is not that old-school web browser; it supports lots of native DOM APIs.

If you're making a Chrome Extension, you should always use native APIs, not only because Chrome has almost the latest DOM APIs available, but this can also avoid performance issue and unnecessary memory occupation (each jQuery-driven extension needs a separate

@austin362667
austin362667 / SharkLong.go
Created September 28, 2022 04:32
Harmonic Pattern Strategy: Shark Long
func (s Harmonic) SharkLong(highs, lows *types.Queue, p float64) float64 {
score := 0.
for x := 5; x < 300; x++ {
X := lows.Index(x)
for a := 4; a < x; a++ {
if highs.Index(a-1) < highs.Index(a) && highs.Index(a) > highs.Index(a+1) {
A := highs.Index(a)
XA := math.Abs(X - A)
hB := A - 0.382*XA
lB := A - 0.618*XA
@c9s
c9s / SharkLong.go
Created September 30, 2022 10:02 — forked from austin362667/SharkLong.go
Harmonic Pattern Strategy: Shark Long
func (s Harmonic) SharkLong(highs, lows *types.Queue, p float64) float64 {
score := 0.
for x := 5; x < 300; x++ {
X := lows.Index(x)
for a := 4; a < x; a++ {
if highs.Index(a-1) < highs.Index(a) && highs.Index(a) > highs.Index(a+1) {
A := highs.Index(a)
XA := math.Abs(X - A)
hB := A - 0.382*XA
lB := A - 0.618*XA
@audreyt
audreyt / posa.mkdn
Last active November 28, 2022 21:24
EtherCalc.tw

從 SocialCalc 到 EtherCalc

先前在《開源應用程式架構》 一書中,我介紹了 SocialCalc 這個在瀏覽器中運行的試算表編輯器,以取代伺服器為中心的 WikiCalc 架構。SocialCalc 在瀏覽器中執行所有的運算,只有在載入和儲存試算表時才會使用伺服器。

追求效能是 Socialtext 團隊在 2006 年時設計 SocialCalc 的主要目的。重點在於:在 JavaScript 環境下執行客戶端運算,儘管在當年的速度僅有伺服器端 Perl 運算的十分之一,但仍然勝過 AJAX 來回傳輸資料造成的網路延遲:


WikiCalc 與 SocialCalc 架構比較

******
@c9s
c9s / .env.local
Last active March 6, 2023 13:37
BBGO 之 MAX 交易所網格設定指南
# API Key 可以在以下頁面建立:
# https://max.maicoin.com/api_tokens/new
#
MAX_API_KEY=
MAX_API_SECRET=