Skip to content

Instantly share code, notes, and snippets.

View okbel's full-sized avatar
💭
idle computing

Bel okbel

💭
idle computing
View GitHub Profile
@okbel
okbel / pm2 > forever
Last active April 16, 2016 06:26
pm2 > forever
pm2 > forever
Basically it took me less than five minutes to configure pm2 while foreverjs took ... forever ( > 30 mins )
The reason behind it: pm2 allows you to name your process the moment you are starting it. So, you can handle it by just
calling it and does not create several instances without reason.
Proof:
forever start --uid "server" server.js ----- pm2 start server.js -n server
## This creates a new instance ##This recognizes the old instance and does not create another
@okbel
okbel / random.sh
Created August 4, 2016 14:17
Random key generator bash
(base64 /dev/urandom | tr -d '/+' | head -c 32 | tr '[:upper:]' '[:lower:]')

Keybase proof

I hereby claim:

  • I am okbel on github.
  • I am okbel (https://keybase.io/okbel) on keybase.
  • I have a public key whose fingerprint is FF23 2330 AD41 61EE FBD5 F420 D8F3 259E DBB9 3FCD

To claim this, I am signing this object:

var s = "JavaScript syntax highlighting";
alert(s);
```javascript
componentDidMount() {
  const contNode = this.refs.cont;
  // Do stuff!
}
```
@okbel
okbel / get-middle.clj
Last active September 9, 2016 15:15
Daily Kata # 1 - Get Middle
(defn get-middle [x]
(if (odd? (count x))
(subs x (Math/floor (/ (count x) 2.0)) (+ (Math/floor (/ (count x) 2.0)) 1))
(subs x (- (/ (count x) 2.0) 1)(+ (/ (count x) 2.0) 1))
))
;; Better
(defn is-even [s] (= 0 (mod (count s) 2)))
(defn mid [s] (int (Math/ceil (/ (count s) 2))))
@okbel
okbel / immutablejs.md
Created December 22, 2016 15:17
ImmutableJS

InmutableJS

InmutableJS is a library from Facebook that provides a series of inmutable data structures. They are always immutable. The reference to them can change but the data inside of them cannot which means you can build predictable and reliable state models. And it becomes really easy to manage your application state. Immutable.js

More about Immutable Data and React React.js Conf 2015 - Immutable Data and React - YouTube

Why ImmutableJS?

  • Immutable Data is faster
  • Tracking mutation and Maintaining state is difficult
  • Encourages you to think differently about how data flows through your application
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH=/Users/bel/.oh-my-zsh
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="robbyrussell"
@okbel
okbel / importer.js
Created March 28, 2017 12:56
importer
import {client as clientPlugins} from 'pluginsConfig';
function importer () {
let context,
importedFiles;
function buildContext() {
/**
* buildContext creates the context for the plugins
* require.context(<path>, true, <regexp>
@okbel
okbel / component.js
Last active November 21, 2017 01:35
import React from 'react';
class Component extends React.Component {
constructor() {
super();
this.state = {
data: [],
};
}
@okbel
okbel / File1.png
Last active March 8, 2018 15:16
Pride Reaction Plugin - Creando un plugin para Talk
File1.png