Skip to content

Instantly share code, notes, and snippets.

View mohebifar's full-sized avatar
🙃

Mohamad Mohebifar mohebifar

🙃
View GitHub Profile
@staltz
staltz / .bashrc
Created March 7, 2017 13:08
Show a macOS notification when a terminal task is done
# Name it whatever you want. I like `y` because in my keyboard layout it's close to `;`
function y() {
previous=$?
if [ $previous -eq 0 ]; then
osascript -e "display notification \"Done\" with title \"Terminal Task\"" && say "it is done";
else
osascript -e "display notification \"Failed\" with title \"Terminal Task\"" && say "it went to the trees";
fi
}
var str = 'class ಠ_ಠ extends Array {constructor(j = "a", ...c) {const q = (({u: e}) => {return { [`s${c}`]: Symbol(j) };})({});super(j, q, ...c);}}' +
'new Promise((f) => {const a = function* (){return "\u{20BB7}".match(/./u)[0].length === 2 || true;};for (let vre of a()) {' +
'const [uw, as, he, re] = [new Set(), new WeakSet(), new Map(), new WeakMap()];break;}f(new Proxy({}, {get: (han, h) => h in han ? han[h] ' +
': "42".repeat(0o10)}));}).then(bi => new ಠ_ಠ(bi.rd));';
try {
eval(str);
} catch(e) {
alert('Your browser does not support ES6!')
}
@broofa
broofa / pre-commit
Last active February 23, 2024 08:55
Git pre-commit hook that runs `eslint` with the `--fix` option to fix up issues where possible, and adds "fix"ed files into the commit
#!/bin/bash
cd "$(git rev-parse --show-toplevel)"
ESLINT="node_modules/.bin/eslint"
pwd
if [[ ! -x "$ESLINT" ]]; then
printf "\t\033[41mPlease install ESlint\033[0m (npm install eslint)\n"
exit 1
fi
// This will open up a prompt for text to send to a console session on digital ocean
// Useful for long passwords
(function () {
var t = prompt("Enter text to be sent to console, (This wont send the enter keystroke)").split("");
function f() {
var character = t.shift();
var i=[];
var code = character.charCodeAt();
var needs_shift = "!@#$%^&*()_+{}:\"<>?~|".indexOf(character) !== -1
@hallaji
hallaji / README.markdown
Last active August 9, 2017 02:49
Iranian National Identifier Validator

Iranian National Identifier Validator

A validator for Iranian (Persian) national identifier or social number

Languages

c#, java, javascript, php

Types

parameter: string (It doesn't support arabic or persian numbers)
return: boolean

@jryans
jryans / devtools-39.md
Last active August 29, 2015 14:18
Drag Elements, Console History, and more – Firefox Developer Edition 39

Quite a few big new features, improvements, and bug fixes made their way into Firefox Developer Edition 39. Update your Firefox [Developer Edition][dev-ed], or [Nightly][nightly] builds to try them out!

Inspector

The [Inspector][inspector] now allows you to move elements around via [drag and drop][dnd]. Click and hold on an element and then drag it to where you want it to go. This feature was added by contributor Mahdi Dibaiee.

[![Drag and Drop][dnd-poster]][dnd-video]

Back in [Firefox 33][fx33], a tooltip was added to the rule view to allow editing curves for cubic bezier CSS animations. In Developer Edition 39, we've greatly enhanced the tooltip's UX by adding various standard curves you can try right away, as well as cleaned up the overall appearance. This was added by new contributor John Giannakos.

@dynamicguy
dynamicguy / install-opencv-2.4.11-in-ubuntu.sh
Last active April 3, 2024 20:20
install opencv-2.4.11 in ubuntu
# install dependencies
sudo apt-get update
sudo apt-get install -y build-essential
sudo apt-get install -y cmake
sudo apt-get install -y libgtk2.0-dev
sudo apt-get install -y pkg-config
sudo apt-get install -y python-numpy python-dev
sudo apt-get install -y libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install -y libjpeg-dev libpng-dev libtiff-dev libjasper-dev
@qwtel
qwtel / WebGLRenderingContext.js
Last active August 29, 2015 14:03
Outline and JSDoc of the WebGLRenderingContext. Based on the WebGL 1.0 API Quick Reference Card http://www.khronos.org/files/webgl/webgl-reference-card-1_0.pdf. Can be used for autocompletion in WebStorm / IntelliJ.
/**
* @constructor
*/
function WebGLRenderingContext() {
}
WebGLRenderingContext.prototype = {
ACTIVE_ATTRIBUTES: 35721,
ACTIVE_TEXTURE: 34016,
ACTIVE_UNIFORMS: 35718,
@brockpalen
brockpalen / qselect-qdel.sh
Last active January 3, 2017 17:25
qselect-samples
#delete all my jobs,
# only do this if you have fewer than a few hundred jobs.
qdel $(qselect -u $USER)
#delete all my queued jobs
qdel $(qselect -u $USER -s Q)
#delete all my jobs submiting with the wrong account
qdel $(qselect -u $USER -A wrongaccount)
@jedi4ever
jedi4ever / nodejs-cluster-zero-downtime.md
Last active February 11, 2024 13:45
nodejs clustering, zero downtime deployment solutions

Clustering: The basics

The trick? pass the file descriptor from a parent process and have the server.listen reuse that descriptor. So multiprocess in their own memory space (but with ENV shared usually)

It does not balance, it leaves it to the kernel.

In the last nodejs > 0.8 there is a cluster module (functional although marked experimental)