Skip to content

Instantly share code, notes, and snippets.

View neroze's full-sized avatar
🎯
Focusing

Jumper neroze

🎯
Focusing
View GitHub Profile
const queryStingToObject = (rawUrl) => {
if (_.isEmpty(rawUrl)) {
return {}
}
return _.zipObject(_.chain(rawUrl)
.replace('?', '') // a=b454&c=dhjjh&f=g6hksdfjlksd
.split('&') // ["a=b454","c=dhjjh","f=g6hksdfjlksd"]
// .map(_.partial(_.split, _, '=', 2)) // [["a","b454"],["c","dhjjh"],["f","g6hksdfjlksd"]]
.map((item) => {
item = item.split('=');
@neroze
neroze / Clipboard.js
Created April 6, 2018 12:25 — forked from rproenca/Clipboard.js
Copy text to clipboard using Javascript. It works on Safari (iOS) and other browsers.
window.Clipboard = (function(window, document, navigator) {
var textArea,
copy;
function isOS() {
return navigator.userAgent.match(/ipad|iphone/i);
}
function createTextArea(text) {
textArea = document.createElement('textArea');
@neroze
neroze / git helper alias
Last active June 6, 2019 08:30
alias : git command helper + utils
# git helper alias
alias gd='git diff '
alias gtc='git commit -m '
alias gl='gl'
alias gm='git merge '
alias go='git checkout '
alias gch='git checkout -b '
alias gtp='git pull '
#!/bin/bash
# # iterm setting
# # open file link to sublime
# # Preferences -> Profile -> Advance -> Semantic History --> Alaway run comman == /usr/local/bin/sublime \1:\2
# IGNORE_BUCKET="node_modules|out|grunt|build|scriptsDL|css|bower_components|.git|vendor|test"
# searchTestFile="--scope=test"
# if [[ $2 = $searchTestFile ]]
# then
@neroze
neroze / search-with-find-and-grep
Last active March 1, 2018 06:20
search file content with bash find and grep
#!/bin/bash
IGNORE_BUCKET="node_modules|out|grunt|build|scriptsDL|css|bower_components|.git|vendor|test"
if [[ -z $1 ]]; then
echo 'Required argument not provided, exiting...'
exit 1
fi
# find and grep
@neroze
neroze / app choose
Last active January 23, 2018 11:47
CLI App chooser
var inquirer = require('inquirer');
const util = require('util');
const exec = util.promisify(require('child_process').exec);
var shell = require('shelljs')
const webappDirs = [
`guake -n guake -e 'cd ${'/home/dragonlaw/dragonApps/dragonlawWebApp'} && c && v' guake -r ${'Main'}`,
`guake -n guake -e 'cd ${'/home/dragonlaw/dragonApps/dragonlawWebApp/src/scripts/modules/document'} && c && v' guake -r ${'Document'}`,
`guake -n guake -e 'cd ${'/home/dragonlaw/dragonApps/dragonlawWebApp/src/scripts/modules/doctype'} && c && v' guake -r ${'Doctype'}`,
`guake -n guake -e 'cd ${'/home/dragonlaw/dragonApps/dragonlawWebApp/src/scripts/baseApp'} && c && v' guake -r ${'BaseApp'}`,
@neroze
neroze / app choose
Created January 23, 2018 09:47
CLI App chooser
var inquirer = require('inquirer');
const util = require('util');
const exec = util.promisify(require('child_process').exec);
// var process = require('process');
async function goToApp(app = '~') {
const _cd = `cd ${app.path}`
console.log(`guake -n guake -e cd ${_cd} && fish && ${app.cmd}`);
// const { stdout, stderr } = await exec(`guake -n guake -e ${_cd}`);
// const { stdout, stderr } = await exec(`guake -n guake -e 'cd /home/dragonlaw/jumper/DLapp && fish'`);
@neroze
neroze / logProps-HOC-Component
Created January 10, 2018 07:36
HOC to log props of an components
function logProps(WrappedComponent) {
return class extends React.Component {
componentWillReceiveProps(nextProps) {
console.log('Current props: ', this.props);
console.log('Next props: ', nextProps);
}
render() {
// Wraps the input component in a container, without mutating it. Good!
return <WrappedComponent {...this.props} />;
}
# Path to Oh My Fish install.
set -q XDG_DATA_HOME
and set -gx OMF_PATH "$XDG_DATA_HOME/omf"
or set -gx OMF_PATH "$HOME/.local/share/omf"
# Load Oh My Fish configuration.
source $OMF_PATH/init.fish
alias gd='git diff '
alias gtc='git commit -m '
@neroze
neroze / switch-projects-shell-script
Last active July 7, 2017 04:50
switch-projects-shell-script
echo '\n \n ============================ \n '
echo ' Wellcome to DragonApp...\n'
echo "Choose App you want to work with today \n"
echo '============================ \n \n'
echo "1. Web App \n"
echo "2. Registration App \n"
echo "3. Partner Site App \n"