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 / setting-up-sinatra-with-active-record.md
Last active March 25, 2024 13:26
Setting up Sinatra with Active Record

Setting up Sinatra Project

create an empty project and add a Gemfile

cd ~/Desktop
mkdir project-name
cd project-name
touch Gemfile
@jtallant
jtallant / pulling-and-pushing-to-git.md
Created June 14, 2012 20:39
Basic Unix + Pulling and Pushing to Git

UNIX Commands

pwd present working directory

ls list current directory contents

ls -la list current directory contents in long format and show hidden files

man <some unix command> Bring up the manual pages for a command. Type q to exit

@jtallant
jtallant / importing.md
Created February 22, 2021 18:11
Importing ES6 Classes

/js/AppLazyLoad.js

export default class AppLazyLoad {
    init() {
        console.log('do lazy load work');
    }
}

/js/app.js

@jtallant
jtallant / justin.zsh-theme
Last active February 6, 2021 04:42
ZSH Theme
# vim:ft=zsh ts=2 sw=2 sts=2
#
# agnoster's Theme - https://gist.github.com/3712874
# A Powerline-inspired theme for ZSH
#
# # README
#
# In order for this theme to render correctly, you will need a
# [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts).
#
@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 / html5doctype.php
Created October 15, 2012 18:00
WordPress Genesis HTML5 Doctype
remove_action('genesis_doctype', 'genesis_do_doctype');
add_action('genesis_doctype', 'child_html5_doctype');
/**
* Removes the Genesis doctype and replaces it with an HTML5 doctype
*
* @author Justin Tallant
*/
function child_html5_doctype() {
$doctype = '<!DOCTYPE html>
<html dir="' . get_bloginfo("text_direction") . '" lang="' . get_bloginfo("language") . '">
@jtallant
jtallant / choose-adventure-helper.rb
Created December 13, 2016 22:37
Choose your own adventure Ruby helper
class Choice
attr_reader :text
attr_reader :decision_a
attr_reader :decision_b
def initialize(text, decision_a, decision_b)
@text = text
@decision_a = decision_a
@decision_b = decision_b
end
@jtallant
jtallant / jt-related-posts.php
Created September 7, 2012 22:26
Related Posts Function for WordPress
@jtallant
jtallant / automatically-minify-css.php
Created September 17, 2012 02:41
Automatically minify css if it's been updated.
<?php
/**
* Automatically minifies style.css and writes output to style.min.css
*
* @author Justin Tallant
* @param boolean $minification_is_on when true ends execution of the function
* @return void
* @link http://justintallant.com/switching-between-minified-and-non-minified-css-and-js-files-in-wordpress/
*/
@jtallant
jtallant / mass-assignment.md
Last active December 12, 2016 19:28
Mass Assignment

// app/views/users/edit.html.erb

<form action="/users/1" method="POST">
    <input type="hidden" name="_method" value="PUT"
    <input type="text" name="username" value="jtallant">
    <input type="email" name="email" value="justin.tallant@nycda.com">
    <textarea name="bio">Bio goes here</textarea>
</form>