Skip to content

Instantly share code, notes, and snippets.

View phillipadsmith's full-sized avatar

Phillip Smith phillipadsmith

View GitHub Profile
@marijn
marijn / README.markdown
Last active September 13, 2024 19:00
List of countries in YAML, CSV and TXT format
@io41
io41 / paginated_collection.js
Created February 22, 2011 10:10 — forked from zerowidth/paginated_collection.js
Pagination with Backbone.js
// includes bindings for fetching/fetched
var PaginatedCollection = Backbone.Collection.extend({
initialize: function() {
_.bindAll(this, 'parse', 'url', 'pageInfo', 'nextPage', 'previousPage');
typeof(options) != 'undefined' || (options = {});
this.page = 1;
typeof(this.perPage) != 'undefined' || (this.perPage = 10);
},
fetch: function(options) {
@phillipadsmith
phillipadsmith / gist:965479
Created May 10, 2011 22:08
Tyee API: Example story object with many of the likely properties
{
"hits" : {
"hits" : [
{
"_source" : {
"textWithHtml" : "<p>...</p>",
"section" : "News",
"contribs" : [
"182261"
@MSch
MSch / .vimrc
Created July 3, 2011 16:58
JavaScript highlighting inside underscore.js templates for vim
" Add this to the bottom of your ~/.vimrc to enable jst highlighting
au BufNewFile,BufRead *.jst set syntax=jst
@mathewbyrne
mathewbyrne / slugify.js
Created October 12, 2011 04:34
Javascript Slugify
function slugify(text)
{
return text.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
.replace(/\-\-+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, ''); // Trim - from end of text
}
anonymous
anonymous / log_test11.py
Created November 19, 2011 22:15
Test script showing usage of a buffering SMTP handler.
#!/usr/bin/env python
#
# Copyright 2001-2002 by Vinay Sajip. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appear in all copies and that
# both that copyright notice and this permission notice appear in
# supporting documentation, and that the name of Vinay Sajip
# not be used in advertising or publicity pertaining to distribution
@ryandotsmith
ryandotsmith / a-backbone-js-demo-app-sinatra-backend.md
Created January 22, 2012 01:42
Backbone demo app with sinatra backend

A Backbone.js demo app (Sinatra Backend)

Oct 16 2010

Updates

  • 04/10/2011 - Updated application.js and application.rb thanks to @rebo's comments

In this article, I will walk through some simple steps to get a [demo app][2] up and running with [Backbone.js][3] and [Sinatra][4] on [Heroku][5].

@brianboyer
brianboyer / gist:1696819
Created January 29, 2012 02:21
Lion dev environment notes
@cphilippsen
cphilippsen / acf_relationship_fields
Created April 8, 2012 15:48
ACF Relationship get related posts fields content
<?php if(get_field('relationship')): ?>
<h2>Related posts</h2>
<ul id="portfolio-grid">
<?php foreach(get_field('relationship') as $related): ?>
<li>
<a href="<?php echo get_permalink($related->ID); ?>" title="<?php echo get_the_title($related->ID) ?>">
<img src="<?php the_field('image_src', $related->ID); ?>" alt="" /> <span class="caption"><?php the_field('image_caption', $related->ID); ?></span>
</a>
</li>
@chrislkeller
chrislkeller / README.md
Last active February 3, 2022 08:02
Displaying data from a flat JSON file on a Handlebars.js template file rendered with AJAX.

Demo: ajax-handlebars

This repo's location has changed.