Skip to content

Instantly share code, notes, and snippets.

View MohammedEssehemy's full-sized avatar
👀
Exploring

Essehemy MohammedEssehemy

👀
Exploring
View GitHub Profile
@ohansemmanuel
ohansemmanuel / static-data.js
Created May 18, 2018 14:00
Static data generation for Skypey.
const shortid = require("shortid"); // shortid.generate() returns a unique "short" id
const txtgen = require("txtgen"); // txtgen.sentence() returns random "readable" sentences
const faker = require("faker"); // faker is used for generating random fake data.
const _ = require("lodash"); // lodash is a utility lib for Javascript
const users = generateUsers(10);
export const contacts = _.mapKeys(users, "user_id");
export const getMessages = messagesPerUser => {
let messages = {};
_.forEach(users, user => {
@AmrAbdulrahman
AmrAbdulrahman / forward.js
Last active January 5, 2018 19:59
Forward all files as modules from a directory
/*
It's often we have a bunch of modules that we need to just forward
from a single entry point
as following:
-- src
---- utils
------ isFunction.js
------ isString.js
------ isArray.js
@thornbill
thornbill / .gitlab-ci.yml
Created November 22, 2016 21:29
Example Node GitLab CI Yamlfile
# Official framework image. Look for the different tagged releases at:
# https://hub.docker.com/r/library/node/tags/
image: node:6
before_script:
- npm install
# This folder is cached between builds
# http://docs.gitlab.com/ce/ci/yaml/README.html#cache
cache:
@ravibhure
ravibhure / git_rebase.md
Last active June 25, 2024 13:44
Git rebase from remote fork repo

In your local clone of your forked repository, you can add the original GitHub repository as a "remote". ("Remotes" are like nicknames for the URLs of repositories - origin is one, for example.) Then you can fetch all the branches from that upstream repository, and rebase your work to continue working on the upstream version. In terms of commands that might look like:

Add the remote, call it "upstream":

git remote add upstream https://github.com/whoever/whatever.git

Fetch all the branches of that remote into remote-tracking branches, such as upstream/master:

git fetch upstream

@thiagomgo
thiagomgo / Install-Redis-Desktop-Manager.sh
Created October 11, 2016 14:49
Install Redis Desktop Manager from source on Ubuntu
# Clone the repository from GitHub
git clone --recursive https://github.com/uglide/RedisDesktopManager.git -b 0.8.0 rdm && cd ./rdm
# Compile the source
cd src/
./configure
source /opt/qt56/bin/qt56-env.sh && qmake && make
sudo checkinstall -D --install
sudo gdebi /home/$USER/rdm/src/src_*.deb
cd /usr/share/redis-desktop-manager/bin
@zenorocha
zenorocha / etc-hosts-on-win.md
Last active April 11, 2024 23:07
/etc/hosts on Windows

1. Get your IP Address

echo `ifconfig $(netstat -nr | grep -e default -e "^0\.0\.0\.0" | head -1 | awk '{print $NF}') | grep -e "inet " | sed -e 's/.*inet //' -e 's/ .*//' -e 's/.*\://'`

2. Modify your hosts file

notepad

@HarishChaudhari
HarishChaudhari / passwordRegex.js
Created August 1, 2016 13:29
Password validation RegEx for JavaScript
/**
* Password validation RegEx for JavaScript
*
* Passwords must be
* - At least 8 characters long, max length anything
* - Include at least 1 lowercase letter
* - 1 capital letter
* - 1 number
* - 1 special character => !@#$%^&*
*
@Faheetah
Faheetah / Jenkinsfile.groovy
Last active June 17, 2024 15:05
Jenkinsfile idiosynchrasies with escaping and quotes
node {
echo 'Results included as an inline comment exactly how they are returned as of Jenkins 2.121, with $BUILD_NUMBER = 1'
echo 'No quotes, pipeline command in single quotes'
sh 'echo $BUILD_NUMBER' // 1
echo 'Double quotes are silently dropped'
sh 'echo "$BUILD_NUMBER"' // 1
echo 'Even escaped with a single backslash they are dropped'
sh 'echo \"$BUILD_NUMBER\"' // 1
echo 'Using two backslashes, the quotes are preserved'
sh 'echo \\"$BUILD_NUMBER\\"' // "1"
@ezimuel
ezimuel / sign.sh
Created March 14, 2016 15:50
Sign and verify a file using OpenSSL command line tool. It exports the digital signature in Base64 format.
#!/bin/bash
# Sign a file with a private key using OpenSSL
# Encode the signature in Base64 format
#
# Usage: sign <file> <private_key>
#
# NOTE: to generate a public/private key use the following commands:
#
# openssl genrsa -aes128 -passout pass:<passphrase> -out private.pem 2048
# openssl rsa -in private.pem -passin pass:<passphrase> -pubout -out public.pem
@dferber90
dferber90 / confirmNavigation.js
Last active August 3, 2018 09:44
Confirming Navigation with Iron Router (canceling route transition)
/*
* Adds a confirmation dialogue when the current route contains unsaved changes.
*
* This is tricky because Iron Router doesn't support this out of the box, and
* the reactivity gets in the way.
* In this solution, redirecting to the current route is abused
* as a mechanism to stop the current transition, which Iron Router has no API
* for. Because the redirect would trigger the onStop hook, we keep track of
* whether to run the onStop hook or not ourselves in
* `skipConfirmationForNextTransition`.