Skip to content

Instantly share code, notes, and snippets.

@m14t
m14t / fix_github_https_repo.sh
Created July 5, 2012 21:57
Convert HTTPS github clones to use SSH
#/bin/bash
#-- Script to automate https://help.github.com/articles/why-is-git-always-asking-for-my-password
REPO_URL=`git remote -v | grep -m1 '^origin' | sed -Ene's#.*(https://[^[:space:]]*).*#\1#p'`
if [ -z "$REPO_URL" ]; then
echo "-- ERROR: Could not identify Repo url."
echo " It is possible this repo is already using SSH instead of HTTPS."
exit
fi
@digitaljhelms
digitaljhelms / gist:3014302
Created June 28, 2012 22:08
Sublime Text 2 bash alias & CLI function to open projects without using the `.sublime-project` file extension
# bash alias
alias subl='/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl'
# bash function, usage: $ st -p [projectname] -opt2 -opt3
function st() {
if [ -n "$1" -a -n "$2" ]; then # if more than one argument
if [ "$1" = "-p" -o "$1" = "--project" ]; then # if arg1 is -p or --project
local projectfile="$2"
[[ $projectfile != *.sublime-project ]] && projectfile="$2.sublime-project" # detect if arg2 already includes the ext
if [ -e $projectfile ]; then # does project file exist?
@dwayne
dwayne / 00-install-on-64-bit-ubuntu-14.04.md
Last active January 12, 2024 17:48
Installing node and npm on Ubuntu 12.04 LTS and 64-bit Ubuntu 14.04 LTS.
  1. Navigate to http://nodejs.org/download/ and on the Linux Binaries (.tar.gz) row click to download the 64-bit version of the current latest release.

  2. Say you've downloaded node-v0.10.7-linux-x64.tar.gz into the Downloads directory. Then, open the terminal and type the following:

$ cd ~/Downloads
$ mkdir -p ~/local/node
$ tar xzf node-v0.10.7-linux-x64.tar.gz -C ~/local/node --strip-components=1
$ echo '# Node Enviroment Setup' >> ~/.bashrc
$ echo 'export PATH=$HOME/local/node/bin:$PATH' >> ~/.bashrc
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 3, 2024 19:09
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@Narga
Narga / wordpress-remove-recent-comment-style.php
Created June 7, 2012 08:26
Wordpress Snippets - remove recent comments style
<?php
//http://www.narga.net/how-to-remove-or-disable-comment-reply-js-and-recentcomments-from-wordpress-header
function twentyten_remove_recent_comments_style() {
global $wp_widget_factory;
remove_action( 'wp_head', array( $wp_widget_factory->widgets['WP_Widget_Recent_Comments'], 'recent_comments_style' ) );
}
add_action( 'widgets_init', 'twentyten_remove_recent_comments_style' );
?>
@czottmann
czottmann / example.js
Created April 16, 2012 13:28
Underscore.template: Super-simple/-stupid partials. It's quick and dirty yet it does what I want, so there.
// Fetch the template HTML from the DOM, hand it over to `Underscore.template`,
// assign some variables, and set up a `partial` method.
var template = $("#tmpl-main-section").html(),
compiledTemplate = _.template( template, {
models: aCollectionOfThings,
// See template examples below on usage. It's all very complex.
partial: function( partialName, variables ) {
return _.template(
$( "#tmpl-" + partialName ).html(),
@robcowie
robcowie / Preferences.sublime-settings
Created March 16, 2012 12:36
Example Sublimetext 2 TODO plugin config
{
"color_scheme": "Packages/User/textmate-solarized/Solarized (Dark).tmTheme",
"default_line_ending": "unix",
"dictionary": "Packages/Language - English/en_GB.dic",
"draw_white_space": "selection",
"find_selected_text": true,
"font_face": "menlo",
"font_size": 12,
"highlight_line": true,
@Raynos
Raynos / redirect.md
Created March 1, 2012 00:33
Mongo collection utility
@doitian
doitian / knife.rb
Created December 20, 2011 11:47
Configuration files for chef-solo and knife, so they all use directories inside the chef repo, instead of default global pathes such as /etc, /var
log_level :info
log_location STDOUT
node_name 'solo'
client_key File.expand_path('../solo.pem', __FILE__)
cache_type 'BasicFile'
cache_options( :path => File.expand_path('../checksums', __FILE__))
cookbook_path [ File.expand_path('../../cookbooks', __FILE__) ]
@lancejpollard
lancejpollard / node-folder-structure-options.md
Created November 28, 2011 01:50
What is your folder-structure preference for a large-scale Node.js project?

What is your folder-structure preference for a large-scale Node.js project?

0: Starting from Rails

This is the reference point. All the other options are based off this.

|-- app
|   |-- controllers
|   |   |-- admin