Skip to content

Instantly share code, notes, and snippets.

@JacobHsu
JacobHsu / index.html
Created September 7, 2014 15:34
#CSS Selectors Result// source http://jsbin.com/lewexu/1
<!DOCTYPE html>
<html>
<head>
<link type="text/css" rel="stylesheet" href="stylesheet.css"/>
<title>Result</title>
<style id="jsbin-css">
/*Add your CSS below!*/
a:hover{
text-decoration:none;
@JacobHsu
JacobHsu / index.html
Created September 11, 2014 03:32
#CSS Positioning Result// source http://jsbin.com/nerew/1
<!DOCTYPE html>
<html>
<head>
<link type="text/css" rel="stylesheet" href="stylesheet.css"/>
<title>Result</title>
</head>
<body>
<h3>The Box Model</h3>
<img src="http://s3.amazonaws.com/codecademy-blog/assets/ae09140c.png"/>
<p>Image courtesy of www.w3.org!</p>
@JacobHsu
JacobHsu / index.html
Created October 11, 2014 04:03
#JS You can also think of objects as combinations of key-value pairs (like arrays) // source http://jsbin.com/cuzaye/1
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
var phonebookEntry = {};
@JacobHsu
JacobHsu / index.html
Created October 12, 2014 23:57
Contact List #JS // source http://jsbin.com/lakuxu/1
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
var friends = {};
@JacobHsu
JacobHsu / wget.js
Created October 17, 2014 07:12
Downloading using wget #nodejs
//note: http://www.html-js.com/article/1961
// Function to download file using wget
var download_file_wget = function(file_url) {
// extract the file name
var file_name = url.parse(file_url).pathname.split('/').pop();
// compose the wget command
var wget = 'wget -P ' + DOWNLOAD_DIR + ' ' + file_url;
// excute wget using child_process' exec function
@JacobHsu
JacobHsu / Objects_loop.js
Created October 21, 2014 00:58
#JS - Introduction to Objects Loop the loop
// Our Person constructor
function Person (name, age) {
this.name = name;
this.age = age;
}
// Now we can make an array of people
var family = new Array();
family[0] = new Person("alice", 40);
family[1] = new Person("bob", 42);
var express = require('express');
var app = express();
app.get('/', function (req, res) {
var q = req.query.q;
res.send(q);
});
@JacobHsu
JacobHsu / router.js
Last active August 29, 2015 14:08
#Nodejs getPost
var async = require('async');
module.exports = function(app) {
app.get('/get', function (req, res){
res.send('Got a GET request');
console.log(req.query);
});
app.post('/post', function (req, res) {
res.send('Got a POST request');
@JacobHsu
JacobHsu / simple-queue.js
Created October 27, 2014 08:47
#nodejs Implementing a Job Queue with Node.js & kue / examples / video.js
var kue = require('kue')
, jobs = kue.createQueue()
;
function newJob (name){
name = name || 'Default_Name';
var job = jobs.create('video conversion', {
title: name + '\'s to avi', user: 1, frames: 200
});
@JacobHsu
JacobHsu / script.js
Created October 29, 2014 00:55
#JS Penguins, Properties, and the Prototype
function Penguin(name) {
this.name = name;
this.numLegs = 2;
}
// create your Emperor class here and make it inherit from Penguin
function Emperor (name){
this.name = name;
}