Skip to content

Instantly share code, notes, and snippets.

View jackmahoney's full-sized avatar

Jack Mahoney jackmahoney

View GitHub Profile
=background-image($bg,$bg-retina)
background-image: $bg
+retina
background-image: $bg-retina
background-size: contain
=retina
//detect retina with pixel density
@content
@jackmahoney
jackmahoney / package.json
Last active August 29, 2015 14:05
Dev dependencies for React Karma unit testing
{
"dependencies": {
"react": "^0.11.1"
},
"devDependencies": {
"browserify": "^4.2.1",
"karma": "^0.12.22",
"karma-chai": "^0.1.0",
"karma-mocha": "^0.1.9",
"karma-browserify": "^0.2.1",
@jackmahoney
jackmahoney / karma.conf.js
Last active August 29, 2015 14:05
Karma conf for react testing
module.exports = function(config) {
config.set({
frameworks: ['browserify', 'mocha', 'chai'],
//specify browserify preproccesor so we can use server-side components
preprocessors: {
'test/*' : ['browserify']
},
@jackmahoney
jackmahoney / gist:5eafd28fef3e5f1df762
Last active August 29, 2015 14:06
Vertical align CSS
<style>
span{ display: inline-block; vertical align: middle; }
.placeholder { height: 100% }
</style>
<span>Your content here!</span>
<span class="placeholder"></span>
@jackmahoney
jackmahoney / convert.sh
Last active August 29, 2015 14:14
EyeEm in motion
#!/bin/bash
#script takes a video and converts it to frames
#it then slices the frames and uploads them to an eyeem album
#when you scroll the album fast enough it turns back into a video
output_dir=./output/
#convert video to frames, dump in output dir
ffmpeg -i $1 "$output_dir"image-%d.jpg
@jackmahoney
jackmahoney / jm_wp_alchemy_media_access.php
Created July 31, 2012 05:53
Extension of WP_Alchemy mediaaccess class
<?php
include('MediaAccessBase.php');
/**
* @author Jack Mahoney
*/
class WPAlchemy_MediaAccess extends WPAlchemy_MediaAccess_Base{
public $meta_field_class_name = 'media-meta-field';
@jackmahoney
jackmahoney / jm_wp_alc_med_access_ex_impl.php
Created July 31, 2012 05:55
Implementation of media access extension
<div class="clearfix">
<?php $metabox->the_field('cta-feature-img'); ?>
<?php $wpalchemy_media_access->setGroupName('cta-feature-img')->setInsertButtonLabel('Insert CTA Image')->setTab('type'); ?>
<p>
<span class="help">CTA Image - Please upload the Page CTA image at the dimensions: 280px x 146px</span>
<?php echo $wpalchemy_media_access->getField(array('name' => $metabox->get_the_name(), 'value' => $metabox->get_the_value())); ?>
<?php echo $wpalchemy_media_access->getButton(array('label' => 'Upload CTA Image')); ?>
<?php $metabox->the_field('cta-feature-img-meta'); ?>
<?php echo $wpalchemy_media_access->getMetaField(array('groupname'=>'cta-feature-img','name' => $metabox->get_the_name(), 'value' => $metabox->get_the_value())); ?>
@jackmahoney
jackmahoney / script.js
Created October 26, 2016 11:08
Scrape digitalagencynetwork.com
// execute in chrome snippets section on a page such as http://digitalagencynetwork.com/agencies/melbourne/
// copy result into a csv file an voila
var $ = jQuery;
var results = [];
$('.entry .threecol-two.last').each(function(){
var title = $(this).find('h3').text();
var address = $(this).find('a').attr('href');
var emailMatch = $(this).first('h6').text().match(/[\w\.]+@[\w\.]+/);
var email = emailMatch ? emailMatch[0] : 'unknown';
results.push([title,address,email].join(','));
@jackmahoney
jackmahoney / Static typeface
Created February 24, 2014 04:06
Set custom font on an android custom textview. Untested code, be sure to test.
public class TextHelper{
private static TypeFace typeface = null;
public static void setTypeface(Context context, TextView textview){
if(this.typeface == null){
this.typeface = Typeface.createFromAsset(context.getAssets(), "Helvetica_Neue.ttf");
}
textview.setTypeface(face);
}
@jackmahoney
jackmahoney / ecs.tf
Last active September 25, 2018 14:21
ecs-cluster-service-task-definition
/*
ecs cluster and service definitions
*/
resource "aws_ecs_cluster" "ecs" {
name = "${var.name}-ecs"
}
/*
define ecs task for this app
*/