Skip to content

Instantly share code, notes, and snippets.

@cj3kim
cj3kim / Return-part-vector
Created July 1, 2014 05:18
Why doesn't this loop work appropriately?
(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")
part-vector)
)
@cj3kim
cj3kim / gist:a8bdcd43917ce759688d
Created February 24, 2015 01:41
backbone/famous strategy
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({
@cj3kim
cj3kim / serialize.js
Last active August 29, 2015 14:18 — forked from brettz9/serialize.js
/*jslint continue:true*/
/**
* Adapted from {@link http://www.bulgaria-web-developers.com/projects/javascript/serialize/}
* 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 http://www.w3.org/TR/html401/interact/forms.html#h-17.13.2}
* (as used in jQuery). Note: This does not serialize <object>
* elements (even those without a declare attribute) or
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>
Backbone.$ = Zepto
var deferred = collection.fetch()
console.log --> XMLHttpRequest
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() })
.bind(storage)
.fetch({ require: true })
.then(function (user) {
this.user = user;
return bcrypt.compareAsync(password, user.get('password'))
})
@cj3kim
cj3kim / gist:df0bdbaf8fc83b861e19
Created May 26, 2015 03:19
react famous method
var _this = this;
var attributes;
this._eventInput.on('reset-ad-details', function (model) {
attributes = model.attributes;
attributes.setClass = true;
_this.surface.setContent(<AdDetailsComponent { ...attributes } />);
});

Setting up a SSL Cert from Comodo

I use Namecheap.com 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

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
#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];