Skip to content

Instantly share code, notes, and snippets.

View asimpson's full-sized avatar

Adam Simpson asimpson

View GitHub Profile
@asimpson
asimpson / meta-tag.js
Last active August 29, 2015 13:56
Userstyle for the new "flat" Twitter.
(function() {
var jQueryLoader = function() {
var watcherID;
if (!(typeof $ === 'undefined')) {
clearInterval(watchJqueryLoader);
$("head").append("<meta name='viewport' content='width=device-width,initial-scale=1.0'>");
}
}
var watchJqueryLoader = setInterval(jQueryLoader, 100);
})();
@asimpson
asimpson / jekyll-siteleaf.rb
Last active August 29, 2015 13:56 — forked from sskylar/jekyll-siteleaf.rb
Automatically post all Jekyll posts to Siteleaf via Siteleaf API.
require "siteleaf"
require "yaml"
# API settings
Siteleaf.api_key = ''
Siteleaf.api_secret = ''
# site settings
extension = 'md' # set this to whatever extension you are using for your posts.
site_id = ''
@asimpson
asimpson / libsass.markdown
Last active August 29, 2015 14:01
Libsass and extend

This type of extend doesn't currently compile correclty in libsass.

This issue sheds some light on the matter. Libsass has tons of promise, but it won't be ready until the extend engine from Ruby Sass is ported over.

desc "Rolls back the latest release"
task :rollback => :environment do
queue! %[echo "-----> Rolling back to previous release for instance: #{domain}"]
# Delete existing sym link and create a new symlink pointing to the previous release
queue %[echo -n "-----> Creating new symlink from the previous release: "]
queue %[ls "#{deploy_to}/releases" -Art | sort | tail -n 2 | head -n 1]
queue! %[ls -Art "#{deploy_to}/releases" | sort | tail -n 2 | head -n 1 | xargs -I active ln -nfs "#{deploy_to}/releases/active" "#{deploy_to}/current"]
# Remove latest release folder (active release)
@asimpson
asimpson / emulate-cinema.js
Last active August 29, 2015 14:15
A little phantomjs script to emulate a large cinema display if you're working on a laptop or smaller screen.
var page = require ('webpage').create();
page.viewportSize = {
width: 2560,
height: 1440
};
page.open('http://seesparkbox.com', function(status) {
console.log("Status:", status);
if(status === "success") {
webpagetest = require "webpagetest"
gulp.task 'test-perf', ->
wpt = new webpagetest('www.webpagetest.org', 'APIKEY')
parameters =
disableHTTPHeaders: true
private: true
video: true
location: 'Dulles:Chrome'
login: 'admin'
@asimpson
asimpson / get_pods_data.php
Created August 7, 2012 14:37
Pull Pods CMS data into Wordpress template. Mainly made this gist to pull into ST2 via fetch
<?php
$field = pods('pod_name') -> find();
if ( 0 < $field->total() ) {
while ( $field->fetch() ) {
$data = $field -> field('field_name');
echo '<div class="div">';
echo $data;
echo '</div>';
}
}
@asimpson
asimpson / register-enqueue-script.php
Created August 7, 2012 21:12
The proper way to include a script/stylesheet in Wordpress functions.php - wrote this to call from ST2 via fetch
<?php
function adam_load_scripts(){
wp_register_script( 'handle', get_template_directory_uri()."path", array('dep'), 'ver', 'footer?');
//to add a stylesheet, change all script to style except wp_enqueue_script
//wp_register_style( 'handle', get_template_directory_uri()."path", array('dep'), 'ver', 'media')
wp_enqueue_script('handle');
}
add_action('wp_enqueue_scripts', 'adam_load_scripts');
@asimpson
asimpson / wp_query.php
Created August 7, 2012 21:35
WP_Query syntax to easily pull down for use in ST2
<?php
$query = new WP_Query( 'params' );//http://codex.wordpress.org/Function_Reference/WP_Query
while($query->have_posts()) : $query->the_post();
//content goes here
endwhile;
wp_reset_postdata(); // reset the query
@asimpson
asimpson / wp_cpt.php
Created August 14, 2012 13:59
Easy way to pull down a Custom Post Type Boilerplate
<?php
function function_cpt() {
$post_type_args = array(
'label' => "Label",
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 5,
'query_var' => true,