Skip to content

Instantly share code, notes, and snippets.

View mofelee's full-sized avatar
🎯
Focusing

mofelee

🎯
Focusing
View GitHub Profile
@mofelee
mofelee / javascript_resources.md
Last active August 29, 2015 14:06 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
@mofelee
mofelee / css_resources.md
Last active August 29, 2015 14:06 — forked from jookyboi/css_resources.md
CSS libraries and guides to bring some order to the chaos.

Libraries

  • 960 Grid System - An effort to streamline web development workflow by providing commonly used dimensions, based on a width of 960 pixels. There are two variants: 12 and 16 columns, which can be used separately or in tandem.
  • Compass - Open source CSS Authoring Framework.
  • Bootstrap - Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
  • Font Awesome - The iconic font designed for Bootstrap.
  • Zurb Foundation - Framework for writing responsive web sites.
  • SASS - CSS extension language which allows variables, mixins and rules nesting.
  • Skeleton - Boilerplate for responsive, mobile-friendly development.

Guides

@mofelee
mofelee / nginx.conf
Last active August 29, 2015 14:19 — forked from calebwoods/nginx.conf
server { listen 80;
server_name example.com;
access_log /var/log/example.com/nginx.access.log;
error_log /var/log/example.com/nginx.error.log;
root /var/www/apps/example.com/public;
charset utf-8;
location / {
rewrite ^ https://$host$request_uri? permanent;
}
@mofelee
mofelee / promises.js
Last active August 29, 2015 14:20 — forked from danthareja/promises.js
/*
* A quick example of how to use Bluebird and Q to conjure your own promises
*
* Everything going on here is explained further in the following video:
* http://youtu.be/OU7WuVGSuZw?list=PLT-DLWOBKbB4dZ83I_7Ca-sUTvorckG-E
*
*/
// Import node modules
var Q = require('q');
@mofelee
mofelee / minimongoInspectorHelper.js
Last active August 29, 2015 14:23
minimongoInspector
showTable = function(tableName){
var count = 0;
return Tracker.autorun(function(){
// console.clear();
console.table(window[tableName].find().fetch());
count++;
console.log('第' + count + '次刷新', Date())
@mofelee
mofelee / start.sh
Created August 4, 2015 23:14
安装postgresql(ubuntu14.04)
#!/bin/sh
locale-gen zh_CN.UTF-8
apt-get update
echo 'deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main' > /etc/apt/sources.list.d/pgdg.list
# add key
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | \
apt-key add -
apt-get update
@mofelee
mofelee / pg.md
Last active August 29, 2015 14:26
连接用ssh连接到远程postgresql数据库

配置和连接

pg_hba.conf

# IPv4 local connections:
host    all             all             127.0.0.1/32            md5

映射远程端口到本地

ssh -L 63333:localhost:5432 root@pg.mofe.me -f -N

@mofelee
mofelee / mime.types
Last active September 12, 2015 03:45 — forked from zeroasterisk/mime.types
nginx config: /etc/nginx/mime.types
types {
text/html html htm shtml;
text/css css;
text/xml xml;
image/gif gif;
image/jpeg jpeg jpg;
application/x-javascript js;
application/atom+xml atom;
application/rss+xml rss;
@mofelee
mofelee / center.html
Last active September 23, 2015 15:15
把一个层定位在屏幕中间
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>层定位在屏幕中间</title>
<style type="text/css" media="screen">
*{margin:0;padding:0;}
body,html{height:100%;overflow:hidden;}
.body{height:100%;overflow:auto;}
function make_promise() {
var status = 'unresolved',
outcome,
waiting = [],
dreading = [];
function vouch (deed, func) {
switch (status) {
case 'unresolved':
(deed === 'fulfilled' ? waiting: dreading).push(func);