Skip to content

Instantly share code, notes, and snippets.

View AlexanderRD's full-sized avatar

Alexander Donkin AlexanderRD

View GitHub Profile
@AlexanderRD
AlexanderRD / git-pup.sh
Last active August 29, 2015 14:04
Updating submodules within a local git clone
#!/bin/bash
# Exists to fully update the git repo that you are sitting in...
git pull && git submodule init && git submodule update && git submodule status
@AlexanderRD
AlexanderRD / gist:199915cf6f2a5bdc78b8
Created September 11, 2014 11:14
Perform mysqldump from remote server to local directory
mysqldump -hServerName.co.za -uUsername -pPassword dataBaseName > /Local/directory/backup_name.sql
@AlexanderRD
AlexanderRD / gist:1ef5819bc7e79b6c7252
Created September 29, 2014 12:58
Print out list of all branches with last commit date to the branch, including relative time since commit and color coding.
for k in `git branch|perl -pe s/^..//`;do echo -e `git show --pretty=format:"%Cgreen%ci %Cblue%cr%Creset" $k|head -n 1`\\t$k;done|sort -r
@AlexanderRD
AlexanderRD / gist:f32aff58266f4fdc51df
Created October 6, 2014 13:10
SSH remote folder to local machine with tar compression
ssh username@host.co.za "tar -zcf - /remote/dir/target/folder --exclude='/remote/dir/target/folder'" > /local-machine/directory/file.tar.gz
// Multiple excludes can be appended!
@AlexanderRD
AlexanderRD / gist:dad3583959c1ff3651b4
Created October 7, 2014 14:04
Setting folder and file permissions
To change all the directories to 755 (-rwxr-xr-x):
find /opt/lampp/htdocs -type d -exec chmod 755 {} \;
To change all the files to 644 (-rw-r--r--):
find /opt/lampp/htdocs -type f -exec chmod 644 {} \;
@AlexanderRD
AlexanderRD / gist:f929240dca9d0f7016c7
Created November 21, 2014 10:57
Delete all branches that have been merged into current branch
$ git branch --merged | xargs git branch -d
@AlexanderRD
AlexanderRD / gist:3266874f18b37c72529d
Created December 17, 2014 11:02
Basic mysqldump import/export examples
To export:
mysqldump -u mysql_user -p DATABASE_NAME > backup.sql
To import:
mysql -u mysql_user -p DATABASE < backup.sql
@AlexanderRD
AlexanderRD / gist:b8d94553edcdf9216af6
Created April 16, 2015 06:36
Basic FluidReview jQuery Styling
$( document ).ready(function() {
// Registration specific styling
$('#registration .logo').css({"text-align": "center","border-radius": "5px","background": "rgba(255,255,255,0.1)"});
$('#registration').css({"border-radius": "5px"});
// Login specific styling
$('#login').css({"background": "rgba(255,255,255,0.9)","border-top-width": "0"});
});
@AlexanderRD
AlexanderRD / credential_adapter.rb
Created August 31, 2015 12:43
Credential adapter; wraps hash and converts keys into methods
module Patterns
class CredentialAdapter
attr_reader :config_params
def initialize(config_params ={})
@config_params = config_params
end
def method_missing(message, *args, &block)
if config_params.include?(message)
@AlexanderRD
AlexanderRD / chosen_select.js
Created September 10, 2015 09:12
Rails chosen select example
$(function() {
$('.chosen-select').chosen({
allow_single_deselect: true,
no_results_text: 'No results matched'
});
});