Skip to content

Instantly share code, notes, and snippets.

View dbisso's full-sized avatar

Dan Bissonnet dbisso

View GitHub Profile
@dbisso
dbisso / php2twig.php
Last active October 13, 2022 08:31
Twiggify
#!/usr/bin/env php
<?php
$file = $argv[1];
$contents = file_get_contents($file);
/** @var $patterns */
$patterns = [
/** @lang PhpRegExp */
'~<\?= ([^?]+);? \?>~m' => '{{ $1 }}',
@dbisso
dbisso / state.js
Last active May 21, 2024 16:25
Simple state management in vanilla JS
function State() {
this.actions = {};
this.subscriptions = [];
this.history = [];
}
State.prototype.subscribe = function(element, action, callback) {
this.subscriptions[action] = this.subscriptions[action] || [];
this.subscriptions[action].push(function(data) {
callback.apply(element, data);
@dbisso
dbisso / 10_blackfire_repo.config
Last active February 1, 2023 15:12
Set up Blackfire on AWS Elastic Beanstalk
commands:
01_add_blackfire_repo:
command: "sudo yum install -y pygpgme && wget -O - 'http://packages.blackfire.io/fedora/blackfire.repo' | sudo tee /etc/yum.repos.d/blackfire.repo"
@dbisso
dbisso / target-fork-underscores.xml
Created January 15, 2013 19:24
Phing: Target to fork _s (underscores) theme with new name
<target name="fork-underscores">
<input propertyname="theme.name">What do you want to name your _s theme (eg mythemename)?</input>
<copy todir="wp-content/themes/${theme.name}">
<fileset dir="wp-content/themes/_s">
<exclude name=".git" />
<exclude name=".git/*" />
</fileset>
<filterchain>
<replaceregexp>
<regexp pattern="'_s'" replace="'${theme.name}'" ignoreCase="true"/>
@dbisso
dbisso / be.less
Created August 23, 2012 15:19
LESS: Be Responsive – Generator mixins for responsive classes
/**
* Be Responsive
*
* These mixins can be called in media queries to generate
* breakpoint-specific versions of various classes
*/
// Proportional Grid
.be-grid( @bp: 0 ) {
(~".be-full-bp@{bp}") {
@dbisso
dbisso / be-responsive.css
Created July 12, 2012 17:26
CSS: Be Responsive
/*
Format is .be-[behaviour]-bp[n]
Assumptions:
- Breakpoints are defined numerically rather than by device (because we want to be device agnostic).
- bp0 is always the base breakpoint
- Mobile / essentials first development (ie. each sequential bp[n] overrides bp[n-1] )
- The properties that are affected are not defined in other definitions.
If they are there are potential problems with specificity and we want to
avoid !important.
@dbisso
dbisso / gist:2043118
Created March 15, 2012 09:12 — forked from luetkemj/wp-query-ref.php
WP: Query $args
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query
* Source: http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/query.php
*/
$args = array(
@dbisso
dbisso / gist:2002198
Created March 8, 2012 17:24
CSS: Image Replacement
.ir {
border:0;
font: 0/0 a;
text-shadow: none;
color: transparent;
background-color: transparent;
}