Skip to content

Instantly share code, notes, and snippets.

@guozheng
guozheng / hello-swift
Created December 31, 2014 00:07
gist to learn Swift
// Playground - noun: a place where people can play
import UIKit
var str = "Hello, playground"
// array
var a1 = [1, 2]
var a2 = [3, 4]
var a3 = a1 + a2
@guozheng
guozheng / gist:18933d7a641322a993d1
Created June 21, 2014 16:28
sample yelp search response
{
businesses = (
{
categories = (
(
Thai,
thai
)
);
"display_phone" = "+1-415-931-6917";
@guozheng
guozheng / excelInput.java
Created November 29, 2011 06:07
color syntax sample for Tarun Bhadauria
/**
* Reads data from excel file
*
* @param path
* @param sheetNumber
* @param colNumber
* @param startRowNumber
* @return
* @throws Exception
*/
@guozheng
guozheng / install_ff_plugin.sh
Created October 10, 2011 00:58
Comcast script to install firefox plugin toolbar
#!/bin/bash
echo "begin script install_ff_plugin">> ~/.cim_install_log
cd "/tmp/comcast_002/Firefox Plugin/">> ~/.cim_install_log
ruby install_ff_plugin.rb "/tmp/comcast_002/Firefox Plugin">> ~/.cim_install_log 2>&1
@guozheng
guozheng / add_bookmarks.sh
Created October 10, 2011 00:57
Comcast script to add bookmarks
#!/bin/bash
# A script to add some bookmarks to any supported browsers
echo "shell script running">> ~/.cim_install_log
echo $1>> ~/.cim_install_log
echo $2>> ~/.cim_install_log
echo "run ruby script from:">> ~/.cim_install_log
echo $2/ruby/add_bookmarks.rb>> ~/.cim_install_log
cd $2/ruby
ruby $2/ruby/add_bookmarks.rb>> ~/.cim_install_log 2>&1
@guozheng
guozheng / add_bookmarks.rb
Created October 10, 2011 00:54
Comcast add bookmarks Ruby script
#!/usr/bin/ruby
# a script to add some bookmarks, loaded from an xml file
require "rexml/document"
require "json"
require "plist"
require "fileutils"
@guozheng
guozheng / install_ff_plugin.rb
Created October 10, 2011 00:50
Comcast Desktop Installer Ruby script to hijack Firefox
require "rexml/document"
require "fileutils"
FIREFOX_PROFILES_LOCATION = "Library/Application Support/Firefox/Profiles/"
TEMP_DIRECTORY = "comcast_temp_000123"
FIREFOX_TOOLBAR_FILENAME = "XfinitydotcomToolbarMAC.xpi"
abs_path_xpi_directory = File.dirname($0)
# user may pass a commandline argument to override the default location
# of the xpi
@guozheng
guozheng / gist:1099029
Created July 22, 2011 07:28
multi-lang detection js script sample (from http://jsfiddle.net/ambiguous/hDM3T/2/)
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Multi-lang Testing Page</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<!-- Date: 2011-07-21 -->
</head>