Skip to content

Instantly share code, notes, and snippets.

@bencooling
bencooling / Guardfile
Last active December 20, 2015 22:09
Ruby, Gem & Guard
ignore /built\.js/
guard 'shell' do
watch(/script\/(.*).js/) { `node r.js -o build.js` }
end
guard 'shell' do
watch(/sass\/(.*).scss/) { `sass style/style.scss:style/style.css` }
end
@bencooling
bencooling / snippets.php
Created September 16, 2013 23:10
PHP: Snippets
<?php
// Conditional Ajax vs regular HTTP response
if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
echo json_encode($arr);
exit;
}
else {
// do something
}
@bencooling
bencooling / fixes.css
Last active December 23, 2015 16:59
CSS: Cascading Stylesheets
/* Fix webkit blurry light text on dark background */
selector {
-webkit-font-smoothing: antialiased;
}
@bencooling
bencooling / git-branching.md
Last active December 25, 2015 03:29
Useful Git commands

Branching

General

  • Master branch is automatically created by git init
  • When a branch is checked out, the HEAD is pointing to the branches latest commit
  • When multiple branches are merged back into a single branch, say the master, GIT will merge made by the 'recursive' strategy (GIT creates a common commit with multiple parents).

List branches

@bencooling
bencooling / script.js
Created October 15, 2013 03:26
jsonp workflow
$(function(){
var xhr, $form = $('form');
function getResponse(data){
console.log(data);
}
function postForm(){
return $.ajax({
'dataType' : "jsonp",

This is a plugin meant for Jekyll.

Example use:

Easily embed a YouTube video. Just drop this file in your _plugins directory.

{% youtube oHg5SJYRHA0 %}
@bencooling
bencooling / style.scss
Last active January 3, 2016 00:29
Sass: useful functions, mixing, imports, variables etc
// dependencies
@import "vendor/normalize-scss/_normalize";
@import "vendor/bourbon/app/assets/stylesheets/_bourbon";
@import "vendor/neat/app/assets/stylesheets/_neat";
@import "vendor/bitters/app/assets/stylesheets/_bitters";
@import "vendor/bec/jquery.reveal.css";
@import "vendor/animate-css/animate.css";
// Fonts
@import "fonts/rambla/stylesheet.css";
@bencooling
bencooling / Gruntfile.js
Created February 2, 2014 09:14
HTML Email gists
(function () {
'use strict';
module.exports = function(grunt) {
// Plugins
grunt.loadNpmTasks('grunt-contrib-requirejs');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-clean');
@bencooling
bencooling / mail.php
Created February 20, 2014 20:31
mailcatcher configuration with larval
// Send through php mail function
'driver' => 'mail',
// mailcatcher does not support encryption
'encryption' => '',
@bencooling
bencooling / presentation.md
Last active August 29, 2015 13:57
Analysis of bcooling.com.au

Presentation Notes

bcooling.com.au

Progressive enhancement

  • Older browsers don't miss out on any functionality but the UX is richer in modern, capable browsers.
  • Uses PIE polyfill where possible for older browsers