Skip to content

Instantly share code, notes, and snippets.

View ToddSmithSalter's full-sized avatar

Todd Smith-Salter ToddSmithSalter

View GitHub Profile
@redoPop
redoPop / .gitignore
Created June 18, 2010 22:08
Template .gitignore file for WordPress projects
# This is a template .gitignore file for git-managed WordPress projects.
#
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
#
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
#
# See the comments below for more info on how to add exceptions for your
@cowboy
cowboy / HEY-YOU.md
Last active April 9, 2024 15:54
jQuery Tiny Pub/Sub: A really, really, REALLY tiny pub/sub implementation for jQuery.
@mexitek
mexitek / ignoreConfigs.sh
Created September 19, 2011 18:38
Remove and untrack test/config files in Git
echo "*.config">>.gitignore;
git rm --cached "*.config";
git add .;
git commit -m "Ignoring and deleting config files." ;
git push origin;
@JeffreyWay
JeffreyWay / gist:1486709
Created December 16, 2011 16:25
Autosave CSS from Chrome
Autosave from Chrome Notes:
Watch: http://addyosmani.com/blog/autosave-changes-chrome-dev-tools/
Installation Instructions: https://github.com/NV/chrome-devtools-autosave
Afraid of Node? Here's a one-click install: https://sites.google.com/site/nodejsmacosx/
To monitor changes, you have to run `node chrome-devtools-autosave-server/index.js` in the Terminal. This is hard to remember,
so create an alias. Run

#Understanding MVC And MVP (For JavaScript & Backbone Developers)

Before exploring any JavaScript frameworks that assist in structuring applications, it can be useful to gain a basic understanding of architectural design patterns. Design patterns are proven solutions to common development problems and can suggest structural paradigms to help guide us in adding some organization to our application.

I think patterns are exciting as they're effectively a grass roots effort that build upon the collective experience of skilled developers who have previously faced similar problems as we do now. Although developers 10 or 20 years ago may not have been using the same programming languages for implementing patterns, there are many lessons we can learn from their efforts.

In this section, we're going to review two popular patterns - MVC and MVP. The context of our exploration will be how these patterns are related to the popular JavaScript framework Backbone.js, which will be explored in greater detail later on.

anonymous
anonymous / gist:1610208
Created January 14, 2012 04:03
Grab a twitter user's avatar
// Grab a twitter user's avatar with php
//
// usage:
// $photo = get_tiwtter_avatar('alexpgates');
//
// requires xmlize to parse xml into an array
// xmlize is available here: https://github.com/rmccue/XMLize
function get_twitter_avatar($u){
$Url = "http://twitter.com/users/$u.xml";
@boucher
boucher / webhook-mailer.php
Created January 31, 2012 01:45
Stripe Webhook PHP Example
<?php
// SETUP:
// 1. Customize all the settings (stripe api key, email settings, email text)
// 2. Put this code somewhere where it's accessible by a URL on your server.
// 3. Add the URL of that location to the settings at https://manage.stripe.com/#account/webhooks
// 4. Have fun!
// set your secret key: remember to change this to your live secret key in production
// see your keys here https://manage.stripe.com/account
@efedorenko
efedorenko / gist:2028193
Created March 13, 2012 11:22
Function for alpha blending
// Turns out this function already exists in Sass: mix(fg, bg, %) (http://d.pr/mGqa)
// Alpha blending
@function blend($bg, $fg) {
$r: red($fg) * alpha($fg) + red($bg) * (1 - alpha($fg));
$g: green($fg) * alpha($fg) + green($bg) * (1 - alpha($fg));
$b: blue($fg) * alpha($fg) + blue($bg) * (1 - alpha($fg));
<!doctype html>
<!-- http://taylor.fausak.me/2015/01/27/ios-8-web-apps/ -->
<html>
<head>
<title>iOS 8 web app</title>
<!-- CONFIGURATION -->
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"