Skip to content

Instantly share code, notes, and snippets.

@Razoxane
Razoxane / changelog.rb
Created August 15, 2017 02:42 — forked from ttscoff/changelog.rb
Generate release notes from git commit messages
#!/usr/bin/ruby
# A script to automate changelog generation from Git commit messages
#
# For use with a git-flow workflow, it will take changes from the last tagged release
# where commit messages contain NEW, FIXED, and IMPROVED keywords and sort and fromat
# them into a Markdown release note list.
#
# The script takes version information from the macOS command agvtool and bases
# the product name on the first matching Xcode Info.plist found
@Razoxane
Razoxane / laravel_conditional_index_migration.php
Created August 8, 2017 01:35
Laravel - Create Index If Not Exists / Drop Index If Exists
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class LaravelConditionalIndexMigration extends Migration
{
/**
* Run the migrations.
@Razoxane
Razoxane / reloadCSS.js
Created July 28, 2017 23:48 — forked from kdzwinel/reloadCSS.js
Reload CSS files without reloading the page
function reloadCSS() {
const links = document.getElementsByTagName('link');
Array.from(links)
.filter(link => link.rel.toLowerCase() === 'stylesheet' && link.href)
.forEach(link => {
const url = new URL(link.href, location.href);
url.searchParams.set('forceReload', Date.now());
link.href = url.href;
});
@Razoxane
Razoxane / .gitconfig
Last active March 14, 2017 07:12
Git Config - Jade
[core]
editor = nano
[interactive]
singleKey = true
[push]
default = simple
[color]
ui = true
[alias]
#### Generic ####
@Razoxane
Razoxane / gitgrereplace.sh
Last active October 19, 2016 23:47
Git Grep Replace
git grep -lz 'AAA' | xargs -0 perl -i'' -pE "s/AAA/BBB/g"
@Razoxane
Razoxane / .gitconfig
Created August 15, 2016 10:47 — forked from pksunkara/config
Sample of git config file (Example .gitconfig)
[user]
name = Pavan Kumar Sunkara
email = [email protected]
[core]
editor = vim
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
excludesfile = ~/.gitignore
[sendemail]
smtpencryption = tls
smtpserver = smtp.gmail.com
@Razoxane
Razoxane / git-backup-to-AWS-S3.sh
Created June 3, 2016 02:11 — forked from philippb/git-backup-to-AWS-S3.sh
Complete git repository backup script to AWS S3
#!/bin/bash
# Script to backup git repo to S3
# Set bucket, dir, password and account to use for the backup. I keep mine in local env vars
# These are set by localrc which lives on an encrypted home directory and is executed by my bashrc
bucket=$GITHUB_BACKUP_BUCKET
dir=$GITHUB_BACKUP_DIR
password=$GITHUB_BACKUP_PASSWORD
account=$GITHUB_ACCOUNT
@Razoxane
Razoxane / Default (OSX).sublime-keymap -- User
Last active May 13, 2016 00:34 — forked from coldnebo/Default (OSX).sublime-keymap -- User
Jade's custom keymaps for Sublime Text 2
[
/* Fixes Home/End keys for OSX */
{ "keys": ["home"], "command": "move_to", "args": {"to": "bol" } },
{ "keys": ["end"], "command": "move_to", "args": {"to": "eol" } },
{ "keys": ["shift+home"], "command": "move_to", "args": {"to": "bol", "extend": true } },
{ "keys": ["shift+end"], "command": "move_to", "args": {"to": "eol", "extend": true } },
{ "keys": ["super+home"], "command": "move_to", "args": {"to": "bof" } },
{ "keys": ["super+end"], "command": "move_to", "args": {"to": "eof" } },
{ "keys": ["super+shift+home"], "command": "move_to", "args": {"to": "bof", "extend": true } },
{ "keys": ["super+shift+end"], "command": "move_to", "args": {"to": "eof", "extend": true } },
@Razoxane
Razoxane / banker_round.js
Created February 24, 2016 00:49 — forked from FrankFang/banker_round.js
Gaussian/Banker's Rounding in JavaScript
function evenRound(num, decimalPlaces) {
var d = decimalPlaces || 0;
var m = Math.pow(10, d);
var n = +(d ? num * m : num).toFixed(8); // Avoid rounding errors
var i = Math.floor(n), f = n - i;
var e = 1e-8; // Allow for rounding errors in f
var r = (f > 0.5 - e && f < 0.5 + e) ?
((i % 2 == 0) ? i : i + 1) : Math.round(n);
return d ? r / m : r;
}
@Razoxane
Razoxane / 0_reuse_code.js
Last active August 29, 2015 14:24
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console