This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var EventBus = { | |
events: {}, | |
subscribe: function(event, listener) { | |
// create the event if not yet created | |
if(!this.events[event]) this.events[event] = []; | |
// add the listener | |
this.events[event].push(listener); | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# routing | |
Rails.application.routes.draw do | |
namespace :api, defaults: { format: :json } do | |
resources :markets, only: [:index] do | |
resources :languages, param: :key, only: [:index, :show] do | |
resources :labels, params: :item, only: [:show, :update] do | |
resource :translations , only:[:update] do | |
post 'validate' => 'translations#validate' | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// data source | |
var incoming_messages = [ | |
"message 1", | |
"message 2", | |
"message 3", | |
]; | |
// filter set priority | |
function setPriority(message) { | |
return { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
files=$(git diff --cached --name-only | grep '\.jsx\?$') | |
# Prevent ESLint help message if no files matched | |
if [[ $files = "" ]] ; then | |
exit 0 | |
fi | |
failed=0 | |
for file in ${files}; do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. First Install your dependencies: | |
```bash | |
npm install webpack@beta babel-loader babel-core babel-preset-es2015-native-modules --save-dev | |
``` | |
2. Then, Create a `webpack.config.js` file: | |
```js | |
const webpack = require('webpack'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RewriteEngine on | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
# not rewrite css, js and images | |
RewriteCond %{REQUEST_URI} !\.(?:css|js|map|jpe?g|gif|png)$ [NC] | |
RewriteRule ^(.*)$ /index.html?path=$1 [NC,L,QSA] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
python get-pip.py --user | |
export PATH="$PATH:$HOME/.local/bin" | |
pip install --user virtualenvwrapper | |
export WORKON_HOME=$HOME/.virtualenvs | |
export PROJECT_HOME=$HOME/Devel | |
source $HOME/.local/bin/virtualenvwrapper.sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/sh | |
filename=$1 | |
language=$2 | |
output_file=$3 | |
jq --null-input "$(cat $filename)" | jq -r '.' | jq ".[] | {title: .title_" > $output_file |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Reference: https://gist.github.com/werbet/6af175eadd85218f74ac | |
const INTERVALS = [{start:3, end: 5}, {start:0, end: 1}, {start:1, end: 2}, {start:2, end: 3}, {start:2, end: 5}]; | |
function schedule(ready){ | |
let last_end = -1 | |
let running = [] | |
let remainder = [] | |
ready |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://dist-wwgktknioc.now.sh/ |