Skip to content

Instantly share code, notes, and snippets.

View ilovejs's full-sized avatar
🐡

Michael Zhuang (Hao) ilovejs

🐡
  • 08:14 (UTC +11:00)
View GitHub Profile
@ilovejs
ilovejs / flatten.clj
Created April 2, 2015 06:25
recursive function in clojure
(defn flat [x]
(if (coll? x)
(if (empty? x)
[]
(concat (flat (first x)) (flat (rest x))))
[x]))
(flat '((1 2) 3 [4 [5 6]]))
@ilovejs
ilovejs / designer.html
Created March 18, 2015 03:03
designer
<link rel="import" href="../notification-elements/notification-alert.html">
<link rel="import" href="../topeka-elements/category-images.html">
<link rel="import" href="../core-icon/core-icon.html">
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../core-icons/av-icons.html">
<link rel="import" href="../paper-fab/paper-fab.html">
<polymer-element name="my-element">
<template>
package main
import (
"flag"
"fmt"
"log"
"net/rpc"
"sync"
"time"
)
package org.rivendell.collections;
import java.lang.reflect.Array;
public class SkipListNode<T extends Comparable<? super T>> {
private final T value;
private final SkipListNode<T>[] next;
/**
* this is to provide index based access
@ilovejs
ilovejs / markdownRef.md
Created December 19, 2014 01:07
CMD markdown cheatsheet

Sample Markdown Cheat Sheet

This is a sample markdown file to help you write Markdown quickly :)

If you use the fabulous [Sublime Text 2/3 editor][ST] along with the [Markdown Preview plugin][MarkdownPreview], open your ST2 Palette with CMD+⇧+P then choose Markdown Preview in browser to see the result in your browser.

Text basics

this is italic and this is bold . another italic and another bold

@ilovejs
ilovejs / Heroku.md
Last active August 29, 2015 14:11
Heroku Guide

Heroku Guide


Create

git push heroku master

Procfile

Use a Procfile, a text file in the root directory of your application, to explicitly declare what command should be executed to start your app.

e.g. web: gunicorn gettingstarted.wsgi --log-file -
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VariableCapture
{
class Program
{
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
#preview {
/* position: relative;
background: #333;
color: #fff;
float: left;
width: 268px;
@ilovejs
ilovejs / hacknewsParser.py
Last active August 29, 2015 14:07
Parse hacknews and store into sqlite database in form: id, hid, title, url. Able to run the script multiple times, since it's check duplication via hid (unique key for each news).
#!/usr/bin/env python
import requests
from lxml import html
from sqlalchemy import Column, String, Integer
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class Record(Base):
__tablename__ = 'HNews'
package main
import (
"fmt"
"time"
)
// STARTMAIN1 OMIT
type Ball struct{ hits int }