Skip to content

Instantly share code, notes, and snippets.

@sampart
sampart / Vagrantfile
Created February 29, 2016 11:18
Vagrantfile extract - Use NFS if the host operating system supports it
# ...
# Use NFS if the host operating system supports it
config.vm.share_folder("v-root", "/vagrant", "./", :nfs => !RUBY_PLATFORM.downcase.include?("w32"))
# ...
@sampart
sampart / BlessFilter.php
Last active February 23, 2016 14:57
Assetic filter which incorporates Bless (http://blesscss.com/). Designed for use with Symfony and the AsseticBundle, but should be simple to adapt for other situations.
<?php
namespace YourProj\YourBundle\Assetic\Filter;
use Assetic\Asset\AssetInterface;
use Assetic\Exception\FilterException;
use Assetic\Filter\FilterInterface;
/**
* Bless splits up CSS files to get around the limit of 4096 selectors per file in IE<=9.
@sampart
sampart / pre-commit-csfixer
Created May 18, 2015 14:27
git pre-commit hook to run the Coding Standards fixer against changed files
#!/bin/bash
# Coding Standards fixer from http://cs.sensiolabs.org/ pre-commit hook for git
#
# Based on https://github.com/s0enke/git-hooks
#
# @author Soenke Ruempler <[email protected]>
# @author Sebastian Kaspari <[email protected]>
#
# see the README
@sampart
sampart / jira-task-info
Last active August 29, 2015 14:20
Bookmarklet for copying information about selected JIRA task
selectedItem = jQuery('div.ghx-selected');itemId = selectedItem.find('a').attr('href').replace('/browse/', '');itemText = selectedItem.find('.ghx-inner').text();harvestText = itemId + ': ' + itemText;window.prompt('Put this in Harvest', harvestText);
@sampart
sampart / manp.sh
Last active December 28, 2015 08:19
Ubuntu-friendly version of the script at http://www.benzado.com/blog/post/319/nicer-ways-to-view-unix-man-pages; "manp" allows you to view man pages as nicely-formatted PDFs in your PDF viewer. The original Mac version linked to above was a function. This is a shell-script, so put it somewhere in your path. (I originally made this as a function …
#!/bin/bash
M=`man -w $*` # Get path of page source.
if [ -z $M ]; then exit; fi # Quit if it doesn't exist.
N=`basename $M .gz` # Extract the name of the file and
P=/tmp/man.$N.pdf # use it to create a PDF file name.
if [ ! -e $P ]; then # If the PDF file doesn't exist,
echo Creating PDF for $N...
man -t $1 | ps2pdf - $P # generate it.
fi
@sampart
sampart / pr-merged.sh
Created September 27, 2013 14:32
PR been merged on github? This will checkout develop, git pull so that develop has the merged changes, and then delete the branch you were on.
#!/bin/bash
# PR been merged on github? This will checkout develop, git pull, and then delete the branch you were on.
# Thanks http://stackoverflow.com/a/1593487/328817
branch_name="$(git symbolic-ref HEAD 2>/dev/null)" ||
branch_name="(unnamed branch)" # detached HEAD
branch_name=${branch_name##refs/heads/}
if [ "$branch_name" = "develop" ] || [ "$branch_name" = "master" ]
@sampart
sampart / composer.json
Last active December 21, 2015 10:48
Installing Jasmine with Composer.
{
"name": "My jasmine-enabled project",
"description": "A project which installs Jasmine into vendors",
"repositories": [
{
"type": "package",
"package": {
"name": "pivotal/jasmine",
"version": "1.3.1",
"dist": {