Skip to content

Instantly share code, notes, and snippets.

View asimpson's full-sized avatar

Adam Simpson asimpson

View GitHub Profile
@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") {
@jonathanmoore
jonathanmoore / pinterest.js
Created March 26, 2012 23:21 — forked from 65/pinterest.js
pinterest buttons on every image in a blog post using jquery
$().ready(function() {
$('.entry-body img').each(function(){
var $permalink = $(this).parents('.entry').find('.permalink').attr('href');
$(this).wrap('<div class="pinme" style="' + $(this).attr('style') + '" />').after('<a href="http://pinterest.com/pin/create/button/?url=' + $permalink + '&media=' + $(this).attr('src') + '&description=' + $(this).attr('alt') + '" class="pin-it-button" count-layout="vertical">Pin It</a>');
});
$('.pinme').hover(function() {
$(this).children('iframe').css('display','block');
}, function() {
$(this).children('iframe').css('display','none');
@funkatron
funkatron / public_facebook_feeds.txt
Created July 18, 2012 21:12
here's how you get public FB data feeds
This only works with fully public profiles – try accessing the profile while logged-out of Facebook first.
Start with the username for a user. Let's try "thestrokes", from <https://www.facebook.com/thestrokes>
Note that you have to provide a user agent; it doesn't like curl's default. Also use -L to follow redirects.
curl -L -A 'Firefox' https://graph.facebook.com/thestrokes
gives us this:
@jordanmoore
jordanmoore / RWD Screen Width Indicator (em version)
Created July 19, 2012 14:05
Current screen width indicator in EMs (useful for knowing when to add breakpoints when resizing browser window)
<script>
$(window).resize(function() {
var windowWidth = $(window).width();
var bodyFontSize = $('body').css('font-size');
var bodyFontSizeWithoutPx = parseInt(bodyFontSize);
var emValue = windowWidth/bodyFontSizeWithoutPx;
$('.screen-width').text(emValue + 'em');
});
</script>
@jackmcdade
jackmcdade / gist:3484008
Created August 26, 2012 22:44
Bash - archive to desktop
function zipit {
local filename=$1
if [ -z "$filename" ] ; then
filename=${PWD##*/}"-latest"
fi
git archive HEAD --format=zip > ~/Desktop/${filename}.zip
}
@jordanmoore
jordanmoore / RWD Screen Width Indicator
Created July 19, 2012 13:17
Current screen width indicator (useful for knowing when to add breakpoints when resizing browser window)
<script>
$(window).resize(function() {
var windowWidth = $(window).width();
$('.screen-width').text(windowWidth + 'px');
});
</script>
<div id="debug" style="position:fixed;padding:0.3em 0.6em;background:#f1f1f1;font-size:0.6em;bottom:0;left:50%;">
<span class="screen-width">0</span>
</div>
@asimpson
asimpson / sublime_settings.json
Created January 10, 2013 02:46
sublime settings
{
"bold_folder_labels": true,
"close_windows_when_empty": true,
"color_scheme": "Packages/Theme - Aqua/Color Schemes/Tomorrow Night Aqua.tmTheme",
"detect_indentation": false,
"detect_slow_plugins": false,
"draw_centered": false,
"fade_fold_buttons": false,
"font_face": "Menlo",
"font_size": 14.0,
@sskylar
sskylar / jekyll-siteleaf.rb
Last active December 18, 2015 19:39
Jekyll to Siteleaf import script.Imports posts from Jekyll into a Siteleaf page, retains markdown and converts frontmatter into metadata/taxonomy. Requires the Siteleaf Gem (https://github.com/siteleaf/siteleaf-gem).Save to your Jekyll site folder and run in the command line using "ruby jekyll-siteleaf.rb".
require "siteleaf"
require "yaml"
# API settings
Siteleaf.api_key = '...'
Siteleaf.api_secret = '...'
# site settings
site_id = '...'
page_id = '...' # blog page to import posts into
// PhantomJS Cheatsheet
$ brew update && brew install phantomjs // install PhantomJS with brew
phantom.exit();
var page = require('webpage').create();
page.open('http://example.com', function() {});
page.evaluate(function() { return document.title; });
@gyrus
gyrus / gist:3155982
Created July 21, 2012 14:40
Rename WordPress "Posts" to "News"
<?php
/**
* Rename "Posts" to "News"
*
* @link http://new2wp.com/snippet/change-wordpress-posts-post-type-news/
*/
add_action( 'admin_menu', 'pilau_change_post_menu_label' );
add_action( 'init', 'pilau_change_post_object_label' );
function pilau_change_post_menu_label() {