Skip to content

Instantly share code, notes, and snippets.

Less is more; more is less.

cybai CYBAI

Less is more; more is less.
View GitHub Profile
CYBAI / randomInt.js
Last active Aug 29, 2015
Get random value between two values
View randomInt.js
* This function generates a random Integer between two numbers min and max.
function (min, max) {
return Math.floor(Math.random() * max) + min;
Last active Aug 29, 2015
My memo of JSDC 2014

JSDC 2014

Day 1

The Future of the Enterprise Web App

Q1: What's the perspective service of Sencha
Q2: How to improve Sencha with Sencha service

CYBAI / String.prototype.replaceAt.js
Last active Aug 29, 2015
Replace character at particular index
View String.prototype.replaceAt.js
* String replace character at particular index(es)
* @param {Int or IntArray} index [index to start]
* @param {String} character [character which you want to replace]
* @return {String} [Replaced character]
String.prototype.replaceAt = function(index, character) {
if (typeof index !== 'number' && index instanceof Array !== true) {
throw Error('Please pass a number or an array of number as first argument and your index is ' + index);
CYBAI / LazyLoad.js
Last active Nov 12, 2015 — forked from contra/LazyLoad.js
lazy loading react components, useful for video/audio/etc
View LazyLoad.js
import React from 'react';
import ReactDOM from 'react-dom';
import isVisible from './isVisible';
class LazyLoad extends React.Components {
constructor() {
this.props = {
distance: 100

Multiple MySQL Versions with Homebrew

For homebrew version 0.9.5.

brew -v # => Homebrew 0.9.5

Install the current version of mysql.

# Install current mysql version
brew install mysql
CYBAI / prism-textarea.js
Created Jun 29, 2016
[WIP] Make `textarea` syntax highlight
View prism-textarea.js
var script = document.createElement('script');
script.src = '';
var csslink = document.createElement('link');
csslink.setAttribute('rel', 'stylesheet');
csslink.setAttribute('type', 'text/css');
csslink.setAttribute('href', '');
CYBAI / iterm.scpt
Created Jun 30, 2016 — forked from gnachman/iterm.scpt
Replace /Applications/Docker/Docker Quickstart with this.
View iterm.scpt
set itermRunning to (application "iTerm" is running)
set scriptPath to quoted form of POSIX path of ((path to me as text) & "::" & "")
set user_shell to do shell script "dscl /Search -read /Users/$USER UserShell | awk '{print $2}'"
tell application "iTerm"
if not (exists window 1) or (itermRunning = false) then
end if
CYBAI / step3.js
Last active Aug 5, 2016
Fix step3 in `transducing in javascript` from `getify`
View step3.js
function add1(v) { return v + 1; }
function isOdd(v) { return v % 2 == 1; }
function sum(total,v) { return total + v; }
function listReduction(list,v) {
return list;
function mapReducer(fn) {
Last active Sep 15, 2016
Note for Modern Web 2016
View tmux-cheatsheet.markdown

tmux shortcuts & cheatsheet

start new:


start new with session name:

tmux new -s myname
You can’t perform that action at this time.