Skip to content

Instantly share code, notes, and snippets.

View oshybystyi's full-sized avatar

Oleksandr Shybystyi oshybystyi

  • Ukraine, Lutsk
View GitHub Profile
@oshybystyi
oshybystyi / TestModel.js
Last active March 31, 2018 11:08
Checking how to know old attribute values in mongoose middleware
var mongoose = require('mongoose'),
Schema = mongoose.Schema;
var testModelSchema = new Schema({
name: String,
ready: {type: Boolean, default: false}
});
testModelSchema.pre('init', function(done) {
console.log('------------------');
@oshybystyi
oshybystyi / git-auto-status.plugin.zsh
Created June 10, 2015 10:28
OhMyZsh plugin to display git status after a bunch of predefined git commands
#
# Run git status after specified set of command
#
# @author Oleksandr Shybystyi oleksandr.shybystyi@gmail.com
#
# default list of git commands `git status` is running after
gitPreAutoStatusCommands=(
'add'
'rm'
# zsh
EMOJI=(💩 🐦 🚀 🐞 🎨 🍕 🐭 👽 ☕️ 🔬 💀 🐷 🐼 🐶 🐸 🐧 🐳 🍔 🍣 🍻 🔮 💰 💎 💾 💜 🍪 🌞 🌍 🐌 🐓 🍄 )
function random_emoji {
echo -n "$EMOJI[$RANDOM%$#EMOJI+1]"
}
PROMPT="$(random_emoji) "
RPROMPT='%c'
@oshybystyi
oshybystyi / bootstrap.js
Last active May 30, 2017 01:12
Load default preferences for firefox bootstrap (restartless) addons
/**
* Default addon bootstrap file
* full example can be found here https://github.com/oshybystyi/FireX-Pixel-Perfect/blob/issue-5-make-addon-restartless/bootstrap.js
*/
const defaultPreferencesLoaderLink = 'chrome://<addon-alias/<path-to>/defaultPreferencesLoader.jsm';
function startup(data) {
/** some code here ... **/
loadDefaultPreferences(data.installPath);