Skip to content

Instantly share code, notes, and snippets.

View WooodHead's full-sized avatar

WooodHead

  • Hangzhou
View GitHub Profile
@WooodHead
WooodHead / note.md
Created August 19, 2017 11:01 — forked from yang-wei/note.md
Vue.js tips and tricks

Notes: All the examples below are only tested on Vue.js 1.0 (above).

Notes: The examples below use ES6 so it's recommended to use browserify or webpack to easily integrate babel.

when or where can we use this.$el

When you need to access DOM attribute, be careful with the lifecycle. Vue.js has a few useful lifecycle hooks.

Let's say we want to scroll our component to the bottom (imagine it's a long list with overflow-y: auto) once it's instantiate.

@WooodHead
WooodHead / centos_python_env_setup
Created September 12, 2017 14:28 — forked from floer32/centos_python_env_setup
CentOS 6: Install Python 2.7.4, pip, virtualenv, and virtualenvwrapper on CentOS (plus some bonus items at the end if you want). You should probably run with `sudo`.
#!/bin/bash
# Source: http://toomuchdata.com/2012/06/25/how-to-install-python-2-7-3-on-centos-6-2/
# Install stuff #
#################
# Install development tools and some misc. necessary packages
yum -y groupinstall "Development tools"
yum -y install zlib-devel # gen'l reqs
@WooodHead
WooodHead / app.js
Created September 28, 2017 05:07 — forked from dstroot/app.js
Gulp, BrowserSync, Node, and Nodemon all working in harmony. ;)
/**
* World's simplest express server
* - used to serve index.html from /public
*/
var express = require('express');
var serveStatic = require('serve-static');
var app = express();
app.use(serveStatic(__dirname + '/public'));
@WooodHead
WooodHead / gist:b5fbccf391309efbeb85d70945c0740f
Created October 7, 2017 04:41 — forked from devknoll/gist:8b274f1c5d05230bfade
Basic GraphQL example using the GitHub API
import { graphql, GraphQLString, GraphQLInt } from 'graphql';
import { objectType, enumType, schemaFrom, listOf } from 'graphql-schema';
import request from 'promisingagent';
const repositorySortEnum = enumType('RepositorySort')
.value('CREATED', 'created')
.value('UPDATED', 'updated')
.value('PUSHED', 'pushed')
.value('FULL_NAME', 'full_name')
.end();
@WooodHead
WooodHead / apache, php, mysql for MAC OS X 10.11
Created October 8, 2017 02:04 — forked from aichbauer/apache, php, mysql for MAC OS X 10.11
How to install or run apache, php, and mysql on Mac OSX 10.11 with the Terminal
/**ALLOW HIDDEN FOLDER**/
defaults write com.apple.finder AppleShowAllFiles YES
sudo killall Finder
/**APACHE**/
sudo apachectl start
sudo apachectl stop
sudo apachectl restart
@WooodHead
WooodHead / gist:9c736ada85c7c263aafbd56821a9bd75
Created October 9, 2017 04:36 — forked from jasonrudolph/gist:6057563
GitHub Search API: Get the number of stars for a repository

James Sugrue [asked][1], "@GitHubAPI is there a way to find the number of stars for a given repository?"

Example

$ curl -ni "https://api.github.com/search/repositories?q=more+useful+keyboard" -H 'Accept: application/vnd.github.preview'
{
@WooodHead
WooodHead / tomorrow.style
Created October 9, 2017 13:58 — forked from chrislopresto/tomorrow.style
MWeb Tomorrow Preview CSS Theme
editor
foreground: cccccc
background: 2d2d2d
caret: cc99cc
editor-selection
foreground: ffffff
background: 515151
H1
@WooodHead
WooodHead / gist:ecce5fd67de73cc6410da1489c211636
Created October 12, 2017 10:35 — forked from nghuuphuoc/gist:8282411
Install wkhtmltopdf on Centos 6 x64
$ wget http://wkhtmltopdf.googlecode.com/files/wkhtmltopdf-0.9.9-static-amd64.tar.bz2
$ tar xvjf wkhtmltopdf-0.9.9-static-amd64.tar.bz2
$ mv wkhtmltopdf-amd64 /usr/bin/wkhtmltopdf
// In case you got the issue
// wkhtmltopdf: error while loading shared libraries:
// libfontconfig.so.1: cannot open shared object file: No such file or directory
//
// run the command below:
$ yum install urw-fonts libXext libXrender fontconfig libfontconfig.so.1
@WooodHead
WooodHead / incomes_controller.rb
Created October 14, 2017 08:05 — forked from boriscy/incomes_controller.rb
Print to PDF using phantomjs
# Example controller
class IncomesController < ApplicationController
# Include the print
include Controllers::Print
# GET /incomes/1
def show
@income = present Income.find(params[:id])
respond_to do |format|
@WooodHead
WooodHead / .jsbeautifyrc
Created October 28, 2017 12:21
.jsbeautifyrc
{
"indent_size": 2,
"brace_style": "collapse,preserve-inline",
"break_chained_methods": false,
"preserve_newlines": true,
"max_preserve_newlines": 2
}