Skip to content

Instantly share code, notes, and snippets.

View twslade's full-sized avatar

Thomas Slade twslade

View GitHub Profile
@twslade
twslade / cron.php
Created July 11, 2012 12:45
Magical Git Command
tar cvzf changes.tar.gz `git diff --name-status HEAD~5 HEAD | awk '/^[^D]/ {print $2}'`
git diff --name-status HEAD~1 HEAD | awk '/^[^D]/ {print $2}'
@twslade
twslade / bundle.xml
Created July 23, 2012 19:28
Bundle Css
<PRODUCT_TYPE_bundle>
<reference name="head">
<block type="core/text" name="cdn_prototype">
<action method="setText">
<text><![CDATA[<style type="text/css"></style>]]></text>
</action>
</block>
</reference>
</PRODUCT_TYPE_bundle>
@twslade
twslade / scene7.js
Created September 20, 2012 17:55
Show custom options
$('product-options-wrapper').writeAttribute('style', 'display: block !important');
$$('.product-custom-option').invoke('writeAttribute','type', 'text');
@twslade
twslade / Template.php
Created September 20, 2012 19:49
Magento Translating - Very Easy
$vars = array('test' => 'twinkle');
$text = '
I am making a {{var test}}
what if {{depend test2}}this{{/depend}} does not exist
{{if test3}}does if exists{{/if}}
';
$template = new Varien_Filter_Template();
$template->setVariables($vars);
@twslade
twslade / auto-login
Created November 20, 2014 18:55
Magento Auto Login - Greasemonkey Script
// ==UserScript==
// @name Magento Login
// @namespace magento
// @include *
// @version 1
// @grant none
// ==/UserScript==
if(typeof Prototype !== "undefined"){
if(window.location.href.indexOf('.dev') > 0 && $('page-login') && $('loginForm')){
try{
[color]
ui = true
branch = auto
diff = auto
status = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
@twslade
twslade / Tooling.md
Last active February 17, 2016 18:52
Hello!

Tooling Layers

Our focus today is primarily going to be the first layer of tooling

  1. Layer 1: Locally available tools. Anyone can use and run the tool if they have the codebase. The tools travel with the codebase. Dependencies are managed.
  2. Layer 2: Automated tools based on events. The tools above can be invoked from external services (events).
  3. Layer 3: Build tools. The tools can be installed and built automatically when we move to a containerized development environment, which completely eliminates local dependency management.

SSH Configuration Aggregation

Using ground control (repo of all client skels) to aggregate all ssh into one configuration file.

<?php
$arr = ['one', 'two', 'three', 'four'];
//First class functions
//Functions in variables
$filter = function($item){
return strlen($item) > 3;
};
var_dump(array_filter($arr, $filter));
<?php
interface Functor{
public function __invoke($function);
}
abstract class AFunctor implements Functor{
protected $_storage = null;
public function __construct($data = null){
$this->set($data);
<?php
function compose($a, $b){
return function() use ($a, $b){
$args = func_get_args();
return $b(call_user_func_array($a, $args));
};
}
class Just{