Skip to content

Instantly share code, notes, and snippets.

View Matt-Jensen's full-sized avatar
🟩
GREEN SQUARE GOOD

Matt-Jensen Matt-Jensen

🟩
GREEN SQUARE GOOD
View GitHub Profile
@vxnick
vxnick / gist:380904
Created April 27, 2010 15:52
Array of country codes (ISO 3166-1 alpha-2) and corresponding names
<?php
$countries = array
(
'AF' => 'Afghanistan',
'AX' => 'Aland Islands',
'AL' => 'Albania',
'DZ' => 'Algeria',
'AS' => 'American Samoa',
'AD' => 'Andorra',
@joshwalsh
joshwalsh / Git Bash Prompt
Created January 13, 2011 20:40
Show directory, branch and time since last commit
# Prompt Setup
function minutes_since_last_commit {
now=`date +%s`
last_commit=`git log --pretty=format:'%at' -1`
seconds_since_last_commit=$((now-last_commit))
minutes_since_last_commit=$((seconds_since_last_commit/60))
echo $minutes_since_last_commit
}
@shinzui
shinzui / tmux.conf
Created March 12, 2011 01:08 — forked from bryanl/tmux.conf
tmux.conf
# ~/.tmux.conf
#
# See the following files:
#
# /opt/local/share/doc/tmux/t-williams.conf
# /opt/local/share/doc/tmux/screen-keys.conf
# /opt/local/share/doc/tmux/vim-keys.conf
#
# URLs to read:
#
@micho
micho / nginx.conf
Last active September 29, 2023 16:38 — forked from unixcharles/nginx.conf
nginx config for http/https proxy to localhost:3000
First, install nginx for mac with "brew install nginx".
Then follow homebrew's instructions to know where the config file is.
1. To use https you will need a self-signed certificate: https://devcenter.heroku.com/articles/ssl-certificate-self
2. Copy it somewhere (use full path in the example below for server.* files)
3. sudo nginx -s reload
4. Access https://localhost/
Edit /usr/local/etc/nginx/nginx.conf:
@jpetitcolas
jpetitcolas / camelize.js
Created January 8, 2013 06:40
Camelize a string in Javascript. Example: camelize("hello_world") --> "HelloWorld"
/**
* Camelize a string, cutting the string by separator character.
* @param string Text to camelize
* @param string Word separator (underscore by default)
* @return string Camelized text
*/
function camelize(text, separator) {
// Assume separator is _ if no one has been provided.
if(typeof(separator) == "undefined") {
@sanderhouttekier
sanderhouttekier / name.sublime-project
Last active September 26, 2016 21:07
Sublime Project File #snippet #sublimetext
{
"folders":
[
// add paths per directory you want to show
{
// relative paths to the root
"path": "/",
// optionally give it a different name
"name": "My Project",
// possible folders to exclude
@lsiv568
lsiv568 / dropzone.coffee
Last active September 16, 2016 12:22
This directive uses the HTML5 drag and drop spec as well as the FileReader to base64 encode the dropped files. This allows for easy client/server transfer via REST protocol.
'use strict';
angular.module('reusableThings')
.directive('fileDropzone', () ->
restrict: 'A'
scope: {
file: '='
fileName: '='
}
link: (scope, element, attrs) ->
@cskevint
cskevint / titleize.js
Created June 19, 2013 19:54
Titleize a sentence in JavaScript
function titleize(sentence) {
if(!sentence.split) return sentence;
var _titleizeWord = function(string) {
return string.charAt(0).toUpperCase() + string.slice(1).toLowerCase();
},
result = [];
sentence.split(" ").forEach(function(w) {
result.push(_titleizeWord(w));
});
return result.join(" ");
@Matt-Jensen
Matt-Jensen / Sass Retina Query Mixin
Last active December 22, 2015 01:19
A sass function to generate retina media queries.
/* Update: 5/3/14 - supports IE9+, FF3.5+, Opera9.5+ */
@mixin retina($query: null, $density: 2) {
$dpi: $density * 96;
/* Accepts optional @media query conditions */
@if $query {
$query: "and (#{$query})";
}
@else {
@sindresorhus
sindresorhus / post-merge
Last active May 2, 2024 03:18
git hook to run a command after `git pull` if a specified file was changed.In this example it's used to run `npm install` if package.json changed and `bower install` if `bower.json` changed.Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
#!/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# git hook to run a command after `git pull` if a specified file was changed
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"