Skip to content

Instantly share code, notes, and snippets.

View itelo's full-sized avatar
🎯
Focusing

itelo itelo

🎯
Focusing
View GitHub Profile
import * as fse from 'fs-extra';
function checkIfNameExistsInDirectory(appDirectory) {
return async () => {
if (!(await fse.pathExists(appDirectory))) {
return
}
throw throwError(() => {
print.error('Invalid project name')
module.exports = {
name: 'init',
alias: ['init'],
run: async (toolbox: GluegunToolbox) => {
/**
* initing global/local variables
*/
const projectName = toolbox.parameters.options.name;
const templateName = toolbox.parameters.options.template;
type ExtractPromiseGeneric<P> = P extends Promise<infer T> ? T : never;
const currentDirectory = fs.realpathSync(process.cwd());
function throwError(func: Function) {
return func;
}
function CatchError(err: Function | Error) {
if (typeof err === 'function') {
@itelo
itelo / init.0ebbc73b06d4244d4f1a640e6018b349f29e33ec.ts
Created February 2, 2020 21:56
medium:create-react-app-from-zero:init-"base command created with success"
import { GluegunToolbox, print } from 'gluegun'
module.exports = {
name: 'init',
alias: ['init'],
run: async (toolbox: GluegunToolbox) => {
print.success('base command created with success');
},
}
@itelo
itelo / listzip.clj
Last active December 18, 2019 00:27
(ns listzip.core)
(defn toListZipper
"I don't do a whole lot."
[lToLz]
(list (list) lToLz))
(defn fromListZipper
[lz]
(let [left (first lz)
type ListZipper<T> = [T[], T[]];
function toListZipper<T>(list: T[]): ListZipper<T>;
function toListZipper<T>(list: T[]) {
return [[], list];
}
function fromListZipper<T>(lz: ListZipper<T>): T[]
function fromListZipper<T>([L, R]: ListZipper<T>) {
return [...L.reverse(), ...R];
// flatten.js
const flatten = (array) => {
return array.reduce((acc, elm) => {
if (Array.isArray(elm)) {
acc.push(...flatten(elm))
} else {
acc.push(elm);
}
return acc;
# With the basic (500 MB RAM) you will need a swap with 1 GB to run MEAN.js or
# Gitlab, you can do that following the steps above:
sudo swapon -s
sudo dd if=/dev/zero of=/swapfile bs=1024 count=2048k
sudo mkswap /swapfile
sudo swapon /swapfile
sudo echo '/swapfile none swap sw 0 0' > /etc/fstab
# This sets the system to swap memory only when RAM usage is more than 80%,
# default was swapping when RAM usage was more than 60%, which results in
# most of the services being swapped if you experience a traffic spike.
source /usr/share/nvm/init-nvm.sh
@itelo
itelo / .bashrc
Last active February 23, 2016 19:56
github/gitlab func to cd
github() {
path=$1
count=0
shift
case $path in
*) pathToList=$(ls -d ~/Documentos/github/* | cut -f6 -d '/')
pathToDir=($(ls -d ~/Documentos/github/*))
for i in ${pathToList[*]};
do
echo $count')' $i