Skip to content

Instantly share code, notes, and snippets.

View eclipselu's full-sized avatar
🏠
Working from home

Lu Dang eclipselu

🏠
Working from home
  • Kitchener, Ontario
View GitHub Profile
@eclipselu
eclipselu / 0_reuse_code.js
Created June 18, 2014 09:53
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@eclipselu
eclipselu / rails_resources.md
Created June 18, 2014 09:53 — forked from jookyboi/rails_resources.md
Rails-related Gems and guides to accelerate your web project.

Gems

  • Bundler - Bundler maintains a consistent environment for ruby applications. It tracks an application's code and the rubygems it needs to run, so that an application will always have the exact gems (and versions) that it needs to run.
  • rabl - General ruby templating with json, bson, xml, plist and msgpack support
  • Thin - Very fast and lightweight Ruby web server
  • Unicorn - Unicorn is an HTTP server for Rack applications designed to only serve fast clients on low-latency, high-bandwidth connections and take advantage of features in Unix/Unix-like kernels.
  • SimpleCov - SimpleCov is a code coverage analysis tool for Ruby 1.9.
  • Zeus - Zeus preloads your Rails app so that your normal development tasks such as console, server, generate, and specs/tests take less than one second.
  • [factory_girl](h
@eclipselu
eclipselu / requirements.txt
Last active August 30, 2015 10:18 — forked from mrluanma/requirements.txt
Python 登录新浪微博(requests 真的比 urllib2 强了 2^^32 倍 pip install requests)
requests==2.4.3
rsa==3.1.4
@eclipselu
eclipselu / jigsaw_solver.cpp
Created April 5, 2012 12:53
An Automatic Square Jigsaw Solver
#include <opencv.hpp>
#include <vector>
#include <algorithm>
#include <cmath>
#include <ctime>
#include <string>
#include <iostream>
using namespace cv;
using namespace std;

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

/* Our own header, to be included before all standard system headers */
#ifndef _APUE_H
#define _APUE_H
#if defined(SOLARIS)
#define _XOPEN_SOURCE 500 /* Single UNIX Specification, Version 2 for Solaris 9 */
#define CMSG_LEN(x) _CMSG_DATA_ALIGN(sizeof(struct cmsghdr)+(x))
#elif !defined(BSD)
#define _XOPEN_SOURCE 600 /* Single UNIX Specification, Version 3 */
/**
* determines whether a string is numeric
* LeetCode: http://oj.leetcode.com/problems/valid-number/
*/
class Solution {
public:
bool isSign(const char c) {
return c == '-' || c == '+';
}
class Solution {
public:
bool isNumber(const char *s) {
if (!s) return false;
bool sign = true; bool num = false;
bool e = true; bool dot = true; int space = 0;
char c;
while (c=*s++) {
if (c != ' ' && space == 2) return false;
#include <cstdio>
#include <queue>
#include <iostream>
#include <string>
#include <bitset>
using namespace std;
const int rows = 4, cols = 4;
const int max_num = 1<<(rows * cols);
#include <cstdio>
#include <queue>
#include <iostream>
#include <string>
#include <cstring>
#include <climits>
using namespace std;
const int rows = 4, cols = 5;