Skip to content

Instantly share code, notes, and snippets.

View wildjcrt's full-sized avatar
🦀
have a nice day!

Jerry Lee wildjcrt

🦀
have a nice day!
View GitHub Profile
class MigrateCookie < Struct.new(:app)
def call env
cookies = Rack::Utils.parse_query(env['HTTP_COOKIE'], ';,')
case cookies['_session_id']
when Array
status, headers, body = app.call(env)
headers['Set-Cookie'] =
"#{headers['Set-Cookie']}\n#{expire_old_session}"
[status, headers, body]
else
@yhsiang
yhsiang / UPGRADE.md
Last active August 29, 2015 14:12
Note: upgrade discourse from xdite fork to docker version

UPGRADE

  1. Flush your new Discourse's database. This step is destructive; you must be absolutely certain that you are in the correct container, connecting to the correct database and that it contains no important data.

ssh root@hostname -p 2222

sudo -u postgres psql discourse <<END
DROP SCHEMA public CASCADE;
CREATE SCHEMA public;
ALTER SCHEMA public OWNER TO discourse;
@audreyt
audreyt / permute.rs
Last active October 23, 2021 14:10
use std::collections::Bitv;
use std::num;
fn main() {
let mut solved = Bitv::with_capacity(9999999999u, false);
let mut todo = vec![
1123456789u,
2123456789u,
3123456789u,
4123456789u,
@wildjcrt
wildjcrt / test.rb
Created June 25, 2014 01:16 — forked from tka/test.rb
sql = "select *, (select count(books.id) from books where books.authorsid=authors.id) as books_count from authors "
authors = Author.find_by_sql(sql)
authors.first.books_count
@addyosmani
addyosmani / LICENSE.txt
Last active April 8, 2024 20:15 — forked from 140bytes/LICENSE.txt
Offline Text Editor in < 140 bytes (115 bytes). Powered by localStorage & contentEditable
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Copyright (C) 2014 ADDY OSMANI <addyosmani.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
@ROFISH
ROFISH / Gemfile
Last active August 29, 2015 14:00
#ruby '2.1.0'
source 'https://rubygems.org'
gem 'rack', '~>1.5.2'
gem 'actionpack', '~> 4.1.0.beta1'
gem 'railties', '~> 4.1.0.beta1'
source :rubygems
# We are not loading Active Record, nor Active Resources etc.
# We can do this in any app by simply replacing the rails gem
# by the parts we want to use.
gem "actionpack", "~> 4.0"
gem "railties", "~> 4.0"
gem "tzinfo"
# Let's use thin
@wildjcrt
wildjcrt / learning english.md
Last active December 24, 2015 03:19
英文學習書籍整理
@yorkxin
yorkxin / README.md
Created September 16, 2013 06:43
HTML / Markdown filters by GitHub

html-pipeline: 把 text formatting 做成一層一層的 filter 接成 pipeline

linguist: 自動偵測一段文本或檔案的程式語言, GitHub 本身用它來偵測你專案使用的程式語言

charlock_holmes: 自動偵測文本的文字編碼,來自一個叫做 ICU 的資料庫,不知道是什麼,搜集了一堆文字編碼資訊和地區格式。

github-markdown: 實際在 GitHub 使用的 markdown compiler ,我找不到公開的 repo ,但程式碼是 MIT license ,很神秘…

github-markup: 用來把 README.md 這種檔案給 render 成 HTML

@wildjcrt
wildjcrt / check_bot.rb
Created August 6, 2013 16:18
自動檢查 registrano 報名資訊,讓我在 10 小時前成功加入台灣零時政府第壹次公地放領黑客松的小程式。
# encoding: utf-8
# $ ruby check_bot.rb
require 'open-uri'
@url = 'https://registrano.com/events/handlino-new-opening/registrations/new'
def check?
open(@url) do |f|
f.each_line do |line|
if line.include? '抱歉,目前本活動已額滿。'