Skip to content

Instantly share code, notes, and snippets.


Chris Kim cj3kim

View GitHub Profile
cj3kim / Return-part-vector
Created Jul 1, 2014
Why doesn't this loop work appropriately?
View Return-part-vector
(defn return-part-vector [column-count current-row j]
(loop [ part-vector [] k 0]
(if (< k column-count)
(if (not= j k)
(let [current-column (nth current-row k)]
(recur (conj part-vector current-column) (inc k))))
(println "Do nothing")
cj3kim / gist:a8bdcd43917ce759688d
Created Feb 24, 2015
backbone/famous strategy
View gist:a8bdcd43917ce759688d
var fs = require('fs');
// create the main context
var mainContext = Engine.createContext();
var $ = require('zepto-browserify').$;
var $template = $(fs.readFileSync( __dirname + '/templates/navbar.html', 'utf8'));
var navbarMod = new Modifier();
var navbarSurface = new Surface({
View serialize.js
/*jslint continue:true*/
* Adapted from {@link}
* Changes:
* Ensures proper URL encoding of name as well as value
* Preserves element order
* XHTML and JSLint-friendly
* Disallows disabled form elements and reset buttons as per HTML4 [successful controls]{@link}
* (as used in jQuery). Note: This does not serialize <object>
* elements (even those without a declare attribute) or
View toolbar.js
var React = require('react');
var Toolbar = React.createClass({
render: function () {
return (
<div id="toolbar-toolbar" className="toolbar ql-toolbar ql-snow">
<span className="ql-format-group">
<select title="Size" className="ql-size" >
<option value="16px">Normal</option>
View gist:9885921ccdc4b5d754d8
Backbone.$ = Zepto
var deferred = collection.fetch()
console.log --> XMLHttpRequest
View gist:e9512711a83a57379b36
login: Promise.method(function (email, password) {
if (!email || !password) throw new Error("Email and password are both required.");
var storage = { user: null };
var fetchPromise = new this({ email: email.toLowerCase().trim() })
.fetch({ require: true })
.then(function (user) {
this.user = user;
return bcrypt.compareAsync(password, user.get('password'))
View gist:df0bdbaf8fc83b861e19
var _this = this;
var attributes;
this._eventInput.on('reset-ad-details', function (model) {
attributes = model.attributes;
attributes.setClass = true;
_this.surface.setContent(<AdDetailsComponent { ...attributes } />);
View install-comodo-ssl-cert-for-nginx.rst

Setting up a SSL Cert from Comodo

I use as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

View gist:c0db32ba27face6fe2a7
module LogAnalysis where
import Log
parseMessage :: String -> LogMessage
parseMessage s = LogMessage messageType timestamp message
where wordAry = words s
firstChar = wordAry !! 0
secondChar = wordAry !! 1
messageType = case firstChar of
"I" -> Info
View gist:a991074d1261ec190ede
#include <stdio.h>
#define MAXN 6
int main() {
char c[MAXN] = {'h', 'e', 'l', 'l', 'o' };
/*phao: Declare `a` as an array of 6 elements of pointer to char.*/
char *a[MAXN];
You can’t perform that action at this time.