Skip to content

Instantly share code, notes, and snippets.

View franklingu's full-sized avatar
🎯
Focusing

franklingu franklingu

🎯
Focusing
View GitHub Profile
@franklingu
franklingu / nginxproxy.md
Created September 23, 2016 07:16 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@franklingu
franklingu / php-fastcgi
Created March 17, 2016 02:42
a simple script for serving php scripts
#!/bin/bash
CHILDREN=16
FASTCGI_USER=vagrant
FASTCGI_GROUP=vagrant
FASTCGI_DIR=$(dirname $(readlink -f $0))
PID_FILE=$FASTCGI_DIR/php-fastcgi.pid
SOCKET=$FASTCGI_DIR/php-fastcgi.sock
PHP5=/usr/bin/php-cgi
@franklingu
franklingu / gist:acc39375c669f9f64352
Last active August 29, 2015 14:23
Yelp API Node v2
/* require the modules needed */
var oauthSignature = require('oauth-signature');
var n = require('nonce')();
var request = require('request');
var qs = require('querystring');
var _ = require('lodash');
var base_url = 'http://api.yelp.com/v2/';
var yelpConsumerKey = '<YOUR CONSUMER KEY>';
inputs = %w[
CollectionSelectInput
DateTimeInput
FileInput
GroupedCollectionSelectInput
NumericInput
PasswordInput
RangeInput
StringInput
TextInput
// Q1. Delete the middle node in a given linked list given the fact that you only know about this middle node
// e.g. delete node c from a->b->c->d->e when you are only given c
// Solution: copy the content of d over and delete d
public static boolean deleteNode(Node n) {
if (n == null || n.next == null) {
return false; //error check, reporting failure
}
Node nextNode = n.next;
<!DOCTYPE html>
<!--The following may not work on old browsers or IE-->
<head>
<!--Google font for the arm: j-->
<link href='https://fonts.googleapis.com/css?family=Poller+One' rel='stylesheet' type='text/css'>
<style>
//the overall div for the robot
.robot {
position: relative;
left: 200px;
@franklingu
franklingu / discussion about equals method in java
Last active August 29, 2015 14:00
discussion about equals method in java
Recently I have reading Effective Java and the following really
took me some time to digest as it seems easy but tricky.
Sample code is as the following:
(!Attention: for simplicity, hashCode is not given here)
```
public class EqualsTest {
public class Point {
private int _x;
private int _y;