Skip to content

Instantly share code, notes, and snippets.

View harrifeng's full-sized avatar

Harri Feng harrifeng

View GitHub Profile
@bobbrez
bobbrez / gist:993344
Created May 26, 2011 15:15
MySQL on OS X using Homebrew

Change Permissions

You'll need to change the permissions for /usr/local for your local user.

sudo chown -R whoami /usr/local

Homebrew

The easiest way to get everything setup is to use Homebrew. To do this, you'll need to first install XCode from the standard XCode from Apple Developer site. Afterwards you can just install Homebrew though its normal installation

ruby -e "$(curl -fsSLk https://gist.github.com/raw/323731/install_homebrew.rb)"

#!/usr/bin/tclsh8.5
#
# Usage: git-unmerged branch1 branch2
#
# Shows all the non-common commits in the two branches, where non-common
# commits means simply commits with a unique commit *message*.
proc getlog branch {
lrange [split [exec git log $branch --oneline] "\n"] 0 400
}
@kevinhughes27
kevinhughes27 / Makefile
Created April 4, 2013 15:51
g++ Makefile for OpenCV Project
CC = g++
CFLAGS = -g -Wall
SRCS = HelloWorld.cpp
PROG = HelloWorld
OPENCV = `pkg-config opencv --cflags --libs`
LIBS = $(OPENCV)
$(PROG):$(SRCS)
$(CC) $(CFLAGS) -o $(PROG) $(SRCS) $(LIBS)
@andreagrandi
andreagrandi / parse_json_post.go
Created August 19, 2014 13:28
Parse a JSON http POST in GoLang
package main
import (
"encoding/json"
"fmt"
"net/http"
)
type test_struct struct {
Test string
@tknerr
tknerr / README.md
Last active January 23, 2024 16:42
Vagrant with Ansible Provisioner on Windows

Vagrant with Ansible Provisioner on Windows

Long story short, ansible does not work on a Windows control machine, so you basically have to:

  • either run ansible --connection=local ... in the target vm
  • set up a separate control vm where ansible is installed via shell provisioner

Below are Vagrantfile examples for both approaches

Within the Target VM

摘译自 robots.thoughtbot.com

launchctl 命令加载,卸载开机自动运行的服务,在 OS X 中,服务本身存储在 .plist 文件中(即 property list),这些文件的位置一般在 ~/Library/LaunchAgents/Library/LaunchAgents。可以使用 launchctl load $PATH_TO_LISTunload them with launchctl unload $PATH_TO_LIST 命令来加载/卸载他们。加载就是允许这个程序开机执行,卸载反之。

如果你使用 Homebrew 安装过 mysql 那么下面的安装后提示你可能比较熟悉

To have launchd start mysql at login:
   ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
Then to load mysql now:
@oelmekki
oelmekki / doc.md
Created December 30, 2015 19:37
Rails + Browserify + React + es7

1. Gemfile

gem 'browserify-rails', '1.5.0' # until fix: https://github.com/browserify-rails/browserify-rails/issues/101
gem 'react-rails'

Browserify-rails allows to use browserify within assets pipeline. React-rails is here only to allow to use #react_component (and thus, prerendering).

Note that jquery-rails can be removed from Gemfile, the npm version of jquery and jquery-ujs will be used instead.

anonymous
anonymous / index.html
Created November 2, 2016 07:19
JS Bin redux study No.6 // source https://jsbin.com/fapori
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="redux study No.6">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/redux/3.6.0/redux.js">
</script>
</head>
anonymous
anonymous / index.html
Created November 2, 2016 07:30
JS Bin redux study No.6 // source https://jsbin.com/dowupa
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="redux study No.6">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/redux/3.6.0/redux.js">
</script>
</head>
@harrifeng
harrifeng / rails_find_path_method.rb
Created November 10, 2016 03:55
Very important way to list all the path that already set in routes
Rails.application.routes.named_routes.helpers.select {|h| h.to_s =~ /some_search/ }