Skip to content

Instantly share code, notes, and snippets.

View full-sized avatar

Joe Cheng jcheng5

View GitHub Profile
View DbConn.php
class DbConn
private $db; // handle to connection
function __construct()
global $db_host, $db_user, $db_pass, $db_name;
package com.joecheng.asyncshim.client;
* AsyncShim makes it easy to sequester a class behind GWT.runAsync()
* and cause it to be lazy-loaded, while still making it convenient to
* call (some types of) methods on it from other parts of the code that
jcheng5 / full-width.rb
Created March 23, 2011 19:45
Generate wide character detection code
View full-width.rb
require 'pp'
data ='EastAsianWidth.txt')
data.gsub!(/\s*#.*/, '')
data = data.split
data.reject! {|x| x !~ /;/}
data = {|x| x =~ /;[FW]/}
jcheng5 / unirange.rb
Created July 28, 2011 00:00
Generate ranges for Unicode character classes
View unirange.rb
require 'pp'
Invalid = 0
NonAlpha = -1
Alpha = 1
NumericClasses = ['Nd']
AlphaClasses = ['Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'Nl']
jcheng5 / todo.txt
Created August 23, 2011 05:15
Living Hope todo list
View todo.txt
== Sidebar
- Mailchimp sign up form [Joe]
== What's New
- Provide pictures and captions for slideshow [Natasha, Marc]
- Provide content for homepage posts [Natasha, Marc]
X Provide content for sidebar [Natasha]
- Sign up for newsletter
- Donate
- Click here for overview of Living Hope
jcheng5 / Shell
Created June 5, 2012 07:02 — forked from acdha/Shell
Contortions needed to create an AWS RDS database using UTF-8
View Shell
brew install rds-command-line-tools
rds-create-db-parameter-group mysql-utf8 -f mysql5.1 -d "MySQL 5.1 configured for UTF-8"
rds-modify-db-parameter-group mysql-utf8 \
--parameters="name=character_set_server, value=utf8, method=immediate" \
--parameters="name=character_set_client, value=utf8, method=immediate" \
--parameters="name=character_set_results,value=utf8,method=immediate" \
--parameters="name=collation_server, value=utf8_general_ci, method=immediate" \
--parameters="name=collation_connection, value=utf8_general_ci, method=immediate"
View gist:2961373
if (!sameElements(concat(ts1, ts2), new String[] {"Workspace", "History", "Files", "Plots", "Packages", "Help", "VCS", "PkgBuild"}))
if (!sameElements(concat(ts1, ts2), new String[] {"Workspace", "History", "Files", "Plots", "Packages", "Help", "VCS"}))
if (!sameElements(concat(ts1, ts2), new String[] {"Workspace", "History", "Files", "Plots", "Packages", "Help"}))
return false;
// It's only that the VCS tab is missing. Add it to tabset 1.
jcheng5 / server.R
Last active June 17, 2021 18:37
Shiny example: Diamonds Explorer
View server.R
function(input, output) {
dataset <- reactive({
diamonds[sample(nrow(diamonds), input$sampleSize),]
output$plot <- renderPlot({
jcheng5 / server.R
Created October 26, 2012 17:27
Simple matrixInput example
View server.R
shinyServer(function(input, output) {
output$plot <- reactivePlot(function() {
jcheng5 / server.r
Created October 29, 2012 06:21 — forked from wch/server.r
Experiments with shiny and ggplot2
View server.r
tg <- ToothGrowth
tg$dose <- factor(tg$dose)
# Define server logic
shinyServer(function(input, output) {