Skip to content

Instantly share code, notes, and snippets.

@Jazznight
Jazznight / install.sh
Created March 20, 2017 03:38 — forked from cloverstd/install.sh
install libtorrent and python binds on centos 7
yum install -y boost boost-devel
yum install -y make gcc gcc-c++ kernel-devel python-devel
wget https://github.com/arvidn/libtorrent/releases/download/libtorrent-1_0_10/libtorrent-rasterbar-1.0.10.tar.gz
tar zxvf libtorrent-rasterbar-1.0.10.tar.gz
cd libtorrent-rasterbar-1.0.10.tar.gz
./configure --disable-debug --with-boost-libdir=/usr/lib64 --disable-encryption --enable-python-binding
make && make install
export LD_LIBRARY_PATH=/usr/local/lib/
cd bindings/python
python setup.py build
@Jazznight
Jazznight / introrx.md
Created November 2, 2016 14:08 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@Jazznight
Jazznight / README
Created May 25, 2016 07:30 — forked from glts/README
Benchmark for Vim regexp engine performance
Regular expressions and data from
http://lh3lh3.users.sourceforge.net/reb.shtml
Regular expressions benchmarked:
URI ([a-zA-Z][a-zA-Z0-9]*)://([^ /]+)(/[^ ]*)?
Email ([^ @]+)@([^ @]+)
Date ([0-9][0-9]?)/([0-9][0-9]?)/([0-9][0-9]([0-9][0-9])?)
URI|Email ([a-zA-Z][a-zA-Z0-9]*)://([^ /]+)(/[^ ]*)?|([^ @]+)@([^ @]+)
Word .*SCSI-
@Jazznight
Jazznight / immutable_map.ex
Last active September 25, 2022 19:57
[Elixir] Immutable Map operation
Imagine you have the following structure:
```elixir
iex> users = [
john: %{name: "John", age: 27, languages: ["Erlang", "Ruby", "Elixir"]},
mary: %{name: "Mary", age: 29, languages: ["Elixir", "F#", "Clojure"]}
]
```
We have a keyword list of users where each value is a map containing the name, age and a list of programming languages each user likes. If we wanted to access the age for john, we could write:
@Jazznight
Jazznight / install-tmux
Created February 29, 2016 08:37 — forked from rothgar/install-tmux
Install tmux 1.9 on rhel/centos 6
# Install tmux on Centos release 6.5
# install deps
yum install gcc kernel-devel make ncurses-devel
# DOWNLOAD SOURCES FOR LIBEVENT AND MAKE AND INSTALL
curl -OL https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
tar -xvzf libevent-2.0.21-stable.tar.gz
cd libevent-2.0.21-stable
./configure --prefix=/usr/local
You can place js source code in app/assets/javascripts, but exclude it from Sprockets. And add another dir for webpack generated files, like this:
[config/initializers/assets.rb]
Rails.application.config.assets.tap do |assets|
assets.paths.delete_if { |path|
path =~ Regexp.new('app/assets/javascripts')
}
assets.paths.unshift Rails.root.join('app/assets/webpack').to_s
end
@Jazznight
Jazznight / README.md
Created December 12, 2015 11:59 — forked from kerryrodden/.block
Sequences sunburst

This example shows how it is possible to use a D3 sunburst visualization (partition layout) with data that describes sequences of events.

A good use case is to summarize navigation paths through a web site, as in the sample synthetic data file (visit_sequences.csv). The visualization makes it easy to understand visits that start directly on a product page (e.g. after landing there from a search engine), compared to visits where users arrive on the site's home page and navigate from there. Where a funnel lets you understand a single pre-selected path, this allows you to see all possible paths.

Features:

  • works with data that is in a CSV format (you don't need to pre-generate a hierarchical JSON file, unless your data file is very large)
  • interactive breadcrumb trail helps to emphasize the sequence, so that it is easy for a first-time user to understand what they are seeing
  • percentages are shown explicitly, to help overcome the distortion of the data that occurs wh
@Jazznight
Jazznight / 0_reuse_code.js
Created December 12, 2015 11:40
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@Jazznight
Jazznight / multiple_ssh_setting.md
Created October 18, 2015 15:06 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
1. 將 ajax 的行為都定義在 actions 裡,例如 ProductionActions.js
export function getAllProduction () {
return (dispatch) => {
$.ajax('xxx/products', {
success: (data) => {
disptach({
type: GET_PRODUCTS
data" data
});