Skip to content

Instantly share code, notes, and snippets.

View jtallant's full-sized avatar
:octocat:

Justin Tallant jtallant

:octocat:
View GitHub Profile
@jtallant
jtallant / vagrant-demo.md
Last active August 29, 2015 14:02
vagrant-demo

Generate an SSH Key

You probably already have a public and private key. Check and make sure.

ls -a ~/.ssh | grep id

=> id_rsa
=> id_rsa.pub

@jtallant
jtallant / wp-get-posts-ridiculous-function.php
Last active May 21, 2020 03:05
Ridiculous example of WP source doe
<?php
/**
* Retrieve the posts based on query variables.
*
* There are a few filters and actions that can be used to modify the post
* database query.
*
* @since 1.5.0
* @access public
* @uses do_action_ref_array() Calls 'pre_get_posts' hook before retrieving posts.
@jtallant
jtallant / youtube-to-ga.md
Last active January 4, 2016 09:59
Log YouTube Video Complete to GA

Track YouTube Video Complete to GA

YouTube JS API Docs

<script src="http://www.youtube.com/player_api"></script>
<div class="youtube-player" id="player1" data-videoid="M7lc1UVf-VE"></div>
<div class="youtube-player" id="player2" data-videoid="M7lc1UVf-VE"></div>
@jtallant
jtallant / Guardfile
Created September 23, 2013 19:28
Example Laravel Guardfile
# Given an array of files, they will be concatenated in order. Do no add the file extension, only the name.
# %w(bootstrap/bootstrap.min, profile, application)
guard :concat, type: "js", files: %w(bootstrap/bootstrap.min profile application), input_dir: "public/js", output: "public/js/scripts.min"
# Compass will read from the main config.rb file
guard :compass
# Refresh the browser on save
guard 'livereload' do
watch(%r{.+(?<!\.min)\.(css|html|js|blade\.php)$})
@jtallant
jtallant / guard.md
Last active December 22, 2015 05:58
Guard Setup

Guard

Guard is a command line tool to easily handle events on file system modifications. http://guardgem.org

Github: https://github.com/guard/guard

Guard can be used for many different things related to file system modifications. Our most common use cases will be live-reload and stylesheet compilation.

Just installing guard alone won't give you all the features. You need to install guard as well as the plugins you want to use with it. Jeffrey Way has a great video on installing/using guard. guard-is-your-best-friend

@jtallant
jtallant / annoy.rb
Created August 2, 2013 15:55
Annoying script to run at an Apple Store.
sleep 30 # Gives you a chance to walk away
while true
system("osascript -e 'set volume 7'") # If they turn the volume down, it comes right back up
system('say stop repeating yourself!')
end
@jtallant
jtallant / annoy.rb
Created August 2, 2013 15:55
Annoying script to run at an Apple Store.
sleep 30 # Gives you a chance to walk away
while true
system("osascript -e 'set volume 7'") # If they turn the volume down, it comes right back up
system('say stop repeating yourself!')
end
@jtallant
jtallant / response-iframes.js
Created July 8, 2013 20:16
Responsive iframe embeds
/**
* Responsive iframes
*/
function adjustIframes() {
$('iframe').each(function() {
var $this = $(this),
proportion = $this.data('proportion'),
actual_w = $this.width();
if ( $this.attr('width') === '' ) {
[
{ "keys": ["super+l"], "command": "show_overlay", "args": {"overlay": "goto", "text": ":"} }
]
@jtallant
jtallant / gist:5708718
Created June 4, 2013 19:22
How can I remove the duplication and do something like document.on(click, selector1, selector2, function() { // some code here });
$('.reward-sections ul li a').click(function() {
var type = $(this).data('type');
if ('link' === type || 'coming_soon' === type) {
return true;
}
var reward_data = {
'reward_id': $(this).data('reward-id'),