Skip to content

Instantly share code, notes, and snippets.

Stephen Holdaway stecman

Block or report user

Report or block stecman

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@stecman
stecman / phalcon-namespace-render.php
Last active Aug 29, 2015
Namespace-aware template rendering for Phalcon PHP
View phalcon-namespace-render.php
<?php
use Phalcon\Events\Event;
use Phalcon\Mvc\Application;
use Phalcon\Mvc\User\Plugin;
use Phalcon\Mvc\View;
/**
* Namespaced template rendering for the Phalcon PHP framework
*
@stecman
stecman / hhclient_use.py
Created Feb 21, 2015
Hack lang: Sublime Text 3 plugin to copy fully qualified class name to clipboard using hh_client
View hhclient_use.py
from subprocess import Popen, PIPE, STDOUT
import json
import sublime, sublime_plugin
"""
hhclient_use: copy fully qualified class name to clipboard
Copy the full class name at the current cursor position (or first class in the file)
to the clipboard. Requires the hh_client command line program to provide a JSON formatted
outline of the code in the focused buffer.
@stecman
stecman / dev_spam_fix.sh
Last active Aug 29, 2015
Save yourself the expense of buying cupcakes for the dev team
View dev_spam_fix.sh
#!/bin/bash
#
# Make sure all untracked _ss_environment.php files use SS_SEND_ALL_EMAILS_TO
# Save yourself the expense of buying cupcakes for the dev team
#
function is_tracked() {
local filename="$1"
@stecman
stecman / grid.less
Last active Mar 16, 2017
Mixin based grid for LESS with scoped grid settings
View grid.less
//
// Based on Semantic.gs
//
// Defaults
@columns: 12;
@gutter-width: 25px;
@total-width: 100%;
// Uncomment these two lines and the star-hack width/margin lines below to enable sub-pixel
@stecman
stecman / d2git.py
Last active Aug 29, 2015
Convert folders named d1, d2, d3, etc into git repository
View d2git.py
#!/usr/bin/env python
#
# Convert "versioning" with folders called d1, d2, d3.. into a git repository in the directory
# containing those folders. Written for use on *nix systems for people who weren't using version
# control software for a long time.
import os
import re
import time
import sys
@stecman
stecman / php-server-helper-shell-profile.bash
Last active Aug 30, 2015
Shell helper function for starting PHP dev servers
View php-server-helper-shell-profile.bash
# Run a PHP dev server on the first available port starting at 8000
function serve()
{
local port=8000
# Try ports until an unused one is found
while nc -z localhost $port > /dev/null; do ((port++)); done;
echo -e "\033[44m>> Listening on port $port <<\033[0m"
php -S "0.0.0.0:$port" "$@";
@stecman
stecman / slice-convert.py
Last active May 12, 2016
heyday/silverstripe-slices 0.x to 1.0 config conversion script
View slice-convert.py
#!/usr/bin/env python
# YAML config conversion script for heyday/silverstripe-slices 0.x going to 1.0
#
# Comments and whitespace aren't preserved - this is more to help you out by doing
# the repeatitive part of the conversion. The converted config is written to stdout.
#
# Note that this needs a python module installed to work:
#
# $ pip install pyyaml
@stecman
stecman / less-fix.php
Last active Oct 6, 2015
Script to fix vertical whitespace in LESS/CSS-like files
View less-fix.php
#!/usr/bin/env php
<?php
/**
* Fix vertical whitespace in LESS/CSS-like files
*
* This script fixes selectors that are bunched together with no spacing, and selectors
* that are bunched together with properties and have no vertical spacing. This could be
* done with sed, but the regex escaping was a pain and it's harder to document.
*
View beam-shell-profile.bash
# Helper shell functions and completions for use with Beam
# https://github.com/heyday/beam
# Print the .beamlog file for a beam target.
# Target defaults to live if not given
#
# usage: whatsup [target]
#
function whatsup() {
local server="${1-live}";
@stecman
stecman / _README.md
Last active Dec 20, 2016
bash-completion extract for dealing with colons
View _README.md

Extract from bash-completion for working with stecman/symfony-console-completion

This is an example extract of the minimum amount of the bash-completion project required to use these two functions:

  • __ltrim_colon_completions
  • _get_comp_words_by_ref

The functions here are copied verbatim from the bash_completion source. I recommend not using this extract unless there are no other alternatives. Instead, prefer installing the bash-completion package from your package manager, or install bash-completion from source.

You can’t perform that action at this time.