Skip to content

Instantly share code, notes, and snippets.

View zetavg's full-sized avatar

Pokai Chang zetavg

View GitHub Profile
@zetavg
zetavg / gc.rb
Last active August 29, 2015 14:16
get commenters from FB post.
require 'net/http'
require 'json'
post_id = ARGV[0]
access_token = ARGV[1]
uri = URI("https://graph.facebook.com/v2.2/#{post_id}/comments?limit=5000&access_token=#{access_token}")
body = Net::HTTP.get(uri)
data = JSON.parse(body)
@zetavg
zetavg / gc.rb
Created March 8, 2015 15:48
班代感謝祭_抽獎資料
require 'net/http'
require 'json'
require 'time'
post_id = ARGV[0]
access_token = ARGV[1]
uri = URI("https://graph.facebook.com/v2.2/#{post_id}/comments?limit=5000&access_token=#{access_token}")
body = Net::HTTP.get(uri)
#!/bin/bash
DOKKU_HOST="$(git config --get remote.dokku.url | sed s/\:.*$//g)"
ssh -t "$DOKKU_HOST" "$1" "$2" "$3"
@zetavg
zetavg / get_draw_list.rb
Created April 20, 2015 12:11
從 FB 留言取得抽獎名單給 https://github.com/Neson/RaffleDraw
# Get all commenters from a Facebook post and save the list into a format that
# can be used by https://github.com/Neson/RaffleDraw
#
# Usage:
# $ ruby get_draw_list.rb <access_token> <post_id> [<end_time>]
#
# The result will be write into data.js
#
# Args:
# access_token: (required) A valid access token used to get the infomation
('🐭'..'🐷').to_a

Colorgy 誠徵 暑期工作夥伴

我們相信藉由所學的能力,可以讓校園生活更歡樂繽紛。因此在去年暑假,我們正式開始了 Colorgy 計畫,規劃性的打造開源校園服務,希望為校園與同學們創造更多價值。

https://github.com/colorgy

團隊

我們是 Misk,核心由台科大八位同學組成的跨領域團隊,目前有四位夥伴大量投入產品開發,分別兼顧了前端設計、後端系統及 Mobile App 等領域。

@zetavg
zetavg / pgmirror.rb
Last active August 29, 2015 14:25
Mirror an PG database to another (e.g. production to staging).
#!/usr/bin/env ruby
#
# This script is used to mirror an PG database to another (e.g. production to
# staging). It takes to arguments - the first is the database URL of the
# source, and the second is the the database URL of the target. The target DB
# (second argument) will be wiped out and replaced with the data of the source.
#
# Tested & works. But be cartful with the arguments!
require 'uri'
CSV.open("./form.csv", "wb") do |csv|
TutorAbcForm.find_each do |form|
user = form.user
uid = user.sid
raw_user = JSON.parse RestClient.get("https://colorgy.io/api/v1/users/#{uid }?access_token=#{access_token}")
row = []
row << raw_user['name']
row << raw_user['possible_organization_code']
row << raw_user['possible_department_code']
row << raw_user['possible_started_year']
#!/usr/bin/env node
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
React.ToastAndroid.show('', React.ToastAndroid.SHORT);