Skip to content

Instantly share code, notes, and snippets.

View joho's full-sized avatar
At harbour

John Barton joho

At harbour
View GitHub Profile
#!/bin/bash
ssh git@github.com -o StrictHostKeyChecking=no -o'HostKeyAlgorithms=ssh-rsa' 2&1> /dev/null
ssh git@github.com -o StrictHostKeyChecking=no -o'HostKeyAlgorithms=ssh-dss' 2&1> /dev/null
@joho
joho / Makefile
Last active December 27, 2015 08:39 — forked from toolmantim/Makefile
# A simple Makefile alternative to using Grunt for your static asset compilation
#
## Usage
#
# $ npm install
#
# And then you can run various commands:
#
# $ make # compile files that need compiling
# $ make clean all # remove target files and recompile from scratch
config.vm.provision :shell, :inline => "mkdir -p ~/.ssh && echo \"#{`cat ~/.ssh/known_hosts | grep \^github.com`}\" > ~/.ssh/known_hosts"
@joho
joho / index.html
Created June 13, 2013 05:48
A CodePen by John Barton. Lazy Image Loading for Responsive Design with MetaQuery - If you're doing a responsive site that dynamically loads in extra images, this might be a neater way of doing it in a low latency way
<div class="row">
<h2>Both Images Loaded Immediately</h2>
<div class="col">
<a href="#">
<img src="http://lorempixel.com/500/500/" />
</a>
</div>
<div class="col">
<a href="#">
// LAZY IMAGE LOADING FOR RESPONSIVE
var lazyImageLoad = function () {
$('.lazy-image-container').each(function (index) {
var thisElement,
noScriptElement,
imgElement;
thisElement = $(this);
if (!thisElement.parent().is(':hidden')) {
noScriptElement = thisElement.find("noscript");
@joho
joho / ar_forms.rb
Created May 23, 2013 09:18
How I do Django-esque formsin Rails
# Borrowing the idea for this from http://pivotallabs.com/users/jdean/blog/articles/1706-form-backing-objects-for-fun-and-profit
class Forms::Base
# ActiveModel plumbing to make `form_for` work
extend ActiveModel::Naming
include ActiveModel::Conversion
include ActiveModel::Validations
def persisted?
false
end
@joho
joho / gist:5296677
Last active December 15, 2015 17:29
My notes from the first Melbourne go meetup

Melbourne Go Meetup 2012-04-02

  • for testing look at gocheck (http://labix.org/gocheck)

  • possible other venues for the meetup?

  • @aussiegeek spoke on why choosing go

  • file limit for go on osx is 256?

  • google doesn't use "go get"

  • ec2 (goamz) + openstack (goose) packages

@joho
joho / fake_model.rb
Created February 27, 2013 01:42
my way of half assing DI with rails
class FakeModel < ActiveRecord::Base
def save_and_do_those_other_things
save &&
that_other_model_class.create(:some_attr => self.my_attr_todo_with_something) &&
some_api_class.new.do_that_thing
end
def that_other_model_class
ThatOtherModel