Skip to content

Instantly share code, notes, and snippets.

View evansolomon's full-sized avatar

Evan Solomon evansolomon

View GitHub Profile
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'video',
attributeBindings: [
'autoplay',
'muted',
'height',
'width',
'poster',
import Ember from 'ember';
const {
Component,
computed,
get,
guidFor
} = Ember;
export default Component.extend({
<?php
/*
Example usage:
$template = new Medium_Template( 'Hi, I am {{name|html}}.' );
echo $template->compile( array( 'name' => '<b>Evan</b>' ) );
// Hi, I am &lt;b&gt;Evan&lt;/b&gt;.
echo $template->compile( array( 'name' => 'someone else' ) );
@evansolomon
evansolomon / gist:6347288
Created August 26, 2013 22:11
Closure::bindTo() example
<?php
class Thing {
private $name = "Evan";
}
$thing = new Thing();
class ExtendedThing extends Thing {
function say_name() {
if (isset($this->name))
#/usr/bin/env bash
printenv | grep "^\([[:alnum:]]\|[[:punct:]]\)\+=" | sed 's/=.*$//g' | while read var; do
echo "$var=$(printenv $var)\0"
done
@evansolomon
evansolomon / gist:5494039
Last active December 16, 2015 20:39
Scatter shared script to deploy NPM packages. Specifically written for Impromptu, but generally usable depending on your workflow. Install in: ~/.deploys/__shared/npm Make sure it is executable, and run with scatter -s npm
#!/usr/bin/env bash
# Go to the repo
echo "Switching to $1"
cd $1
# Only publish from master
if git branch | ack "\* master" >/dev/null
then
echo "You're on master, good to go"
@evansolomon
evansolomon / deploy.rb
Created March 17, 2013 00:09
Capistrano task to version files via their names so that they are cacheable as possible (vs query strings). Bases versions on the file contents so that versions are changed as infrequently as possible, and automatically. Updates all references to the static files.
namespace :build do
desc "Name static files by version"
task :version, :roles => :app do
find_static_files = "find #{current_release} -name '*.js' -o -name '*.css'"
capture(find_static_files).split("\n").each do |file|
# Get paths
full_path = file.chomp
relative_path = full_path.clone
relative_path["#{current_release}/"] = ''
@evansolomon
evansolomon / close-debug-bar-on-escape.js
Last active December 10, 2015 06:08
Close Debug Bar with escape key
// Generated by CoffeeScript 1.4.0
(function() {
(function($) {
return $(function() {
var db;
db = window.wpDebugBar;
return $(document).keydown(function(event) {
var _ref, _ref1;
if (((_ref = db.body) != null ? _ref.hasClass('debug-bar-visible') : void 0) && 27 === event.keyCode) {
@evansolomon
evansolomon / wp-core-update.sh
Created October 8, 2012 05:54
WordPress update script
#!/bin/bash
# Delete core directories
rm -rf wp-includes/ wp-admin/
# Delete core files in the root
ls -l | ack "^[^d]" | ack "\swp[^\s]*$" | awk '{print $9}' | xargs rm
# Recover wp-config
git checkout wp-config.php
@evansolomon
evansolomon / gist:3568555
Created September 1, 2012 09:53
Bash helpers for navigating WordPress code
# Alias ST2's command line tool for a shorter (easier-to-remember) name
alias st="/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl"
# Search for an open Sublime Text to a function definition
function fx() {
ack "function &?$1\(" | awk {'print $1'} | sed 's/:$//g' | xargs st
}
# Example usage from the root of a WordPress repository