Skip to content

Instantly share code, notes, and snippets.

View desyncr's full-sized avatar

DC* desyncr

View GitHub Profile
git diff "$@" |
perl -ne '
if (/^diff/) { $diff = $_ }
elsif (/^old mode/) { print $diff, $_ }
elsif (/^new mode/) { print $_ }
' |
git apply -R
#!/bin/sh
# Called by "git push" after it has checked the remote status,
# but before anything has been pushed.
#
# If this script exits with a non-zero status nothing will be pushed.
#
# Steps to install, from the root directory of your repo...
# 1. Copy the file into your repo at `.git/hooks/pre-push`
# 2. Set executable permissions, run `chmod +x .git/hooks/pre-push`
#!/usr/bin/env ruby
# NOTE! this is a work in progress. This is not tested or used regularly.
# Ensures we do not call destructive commands on protected branches.
#
# Called by "git push" after it has checked the remote status,
# but before anything has been pushed.
#
# If this script exits with a non-zero status nothing will be pushed.
#!/bin/sh
# This script will install a Git pre-push hook that prevents force pushing the master branch.
# Install in current Git repo:
# curl -fL https://gist.githubusercontent.com/stefansundin/d465f1e331fc5c632088/raw/install-pre-push.sh | sh
# Uninstall:
# rm .git/hooks/pre-push
# in each repository that you've added this to.
GITROOT=`git rev-parse --show-toplevel 2> /dev/null`
@desyncr
desyncr / gist:a30c95b2129f4c6a3ae2
Created March 31, 2015 02:46
Changes to fix #5524 and #5483
diff --git a/app/assets/javascripts/mobile/mobile.js b/app/assets/javascripts/mobile/mobile.js
index 5cd873f..1bd3710 100644
--- a/app/assets/javascripts/mobile/mobile.js
+++ b/app/assets/javascripts/mobile/mobile.js
@@ -188,15 +188,17 @@ $(document).ready(function(){
$(".stream").delegate("a.comment_action", "tap click", function(evt){
evt.preventDefault();
- var link = $(this);
+ var link = $(this),
@desyncr
desyncr / .gitconfig
Created December 9, 2014 14:08
Minimal .gitconfig configuration
[core]
excludesfile = /home/dc/.gitignore_global
editor = vim
[diff]
# tool = vimdiff
tool = icdiff
# http://www.jefftk.com/icdiff
# https://github.com/jeffkaufman/icdiff
[difftool]
@desyncr
desyncr / gist:c2057854bc098b328a9d
Created October 16, 2014 13:45
create nginx local ssl certs
#!/bin/bash
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout local.key -out local.pem
<?php
require 'vendor/autoload.php';
require "app/bootstrap.php.cache";
require_once "app/AppKernel.php";
$kernel = new \AppKernel('dev', true);
$kernel->loadClassCache();
$kernel->boot();
$boris->onStart(function($worker, $vars) use ($kernel) {
$worker->setLocal('kernel', $kernel);
# Function for starting browser in background
browser() { firefox "$@" & }
#--- Composer
# Fetching latest composer version.
alias getcomposer='curl -s https://getcomposer.org/installer | php'
# Fetching latest composer version if not available and run it.
#!/bin/sh
umask 077
answers() {
echo --
echo SomeState
echo SomeCity
echo SomeOrganization
echo SomeOrganizationalUnit
echo localhost.localdomain