Skip to content

Instantly share code, notes, and snippets.

@weppos
weppos / capistrano_database_yml.rb
Created July 27, 2008 10:04
Provides a couple of tasks for creating the database.yml configuration file dynamically when deploy:setup is run.
#
# = Capistrano database.yml task
#
# Provides a couple of tasks for creating the database.yml
# configuration file dynamically when deploy:setup is run.
#
# Category:: Capistrano
# Package:: Database
# Author:: Simone Carletti <weppos@weppos.net>
# Copyright:: 2007-2010 The Authors
@balupton
balupton / README.md
Last active April 20, 2022 13:21
Ajaxify a Website with the HTML5 History API using History.js, jQuery and ScrollTo
@wesbos
wesbos / is_blog.php
Created September 2, 2011 19:32
WordPress is_blog()
function is_blog () {
global $post;
$posttype = get_post_type($post );
return ( ((is_archive()) || (is_author()) || (is_category()) || (is_home()) || (is_single()) || (is_tag())) && ( $posttype == 'post') ) ? true : false ;
}
Usage:
<?php if (is_blog()) { echo 'You are on a blog page'; } ?>
@mattwiebe
mattwiebe / responsive-images.php
Created September 21, 2011 23:02
Mobile First Responsive Images for WordPress
<?php
/*
Plugin Name: Mobile First Responsive Images
Description: Serve up smaller images to smaller screens.
Version: 0.1.1
Author: Matt Wiebe
Author URI: http://somadesign.ca/
*/
/**
@innotekservices
innotekservices / jquery.spin.js
Created October 16, 2011 02:39
jQuery Plugin for Spin.js
/*
You can now create a spinner using any of the variants below:
$("#el").spin(); // Produces default Spinner using the text color of #el.
$("#el").spin("small"); // Produces a 'small' Spinner using the text color of #el.
$("#el").spin("large", "white"); // Produces a 'large' Spinner in white (or any valid CSS color).
$("#el").spin({ ... }); // Produces a Spinner using your custom settings.
$("#el").spin(false); // Kills the spinner.
@ahmednuaman
ahmednuaman / title_case.php
Created October 19, 2011 09:57
Convert strings to title case
function title_case($string, $delimiters = array(" ", "-", "O'"), $exceptions = array("to", "a", "the", "of", "by", "and", "with", 'it', 'as', "for")) {
/*
* Exceptions in lower case are words you don't want converted
* Exceptions all in upper case are any words you don't want converted to title case
* but should be converted to upper case, e.g.:
* king henry viii or king henry Viii should be King Henry VIII
*/
foreach ($delimiters as $delimiter){
$words = explode($delimiter, $string);
$newwords = array();
@rjz
rjz / cs-jq-plugin-template.coffee
Created September 3, 2012 17:01
Coffeescript jQuery Plugin Class Template
# A class-based template for jQuery plugins in Coffeescript
#
# $('.target').myPlugin({ paramA: 'not-foo' });
# $('.target').myPlugin('myMethod', 'Hello, world');
#
# Check out Alan Hogan's original jQuery plugin template:
# https://github.com/alanhogan/Coffeescript-jQuery-Plugin-Template
#
(($, window) ->
ZSH=$HOME/.oh-my-zsh
ZSH_THEME="muse"
alias zshconfig="st $HOME/.zshrc"
COMPLETION_WAITING_DOTS="true"
plugins=(git git-extras osx sublime)
export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:$PATH
export PATH=$HOME/.macports/bin:$HOME/.macports/sbin:$PATH
@jakob-e
jakob-e / ResponsiveFonts.scss
Created September 22, 2013 09:42
ResponsiveFonts
// SCSS Mixin v.1.0 - beta
// =========================================
// ResponsiveFonts
// =========================================
// Config
$base-width:960 !default; // Width @ 100% layout or 1:1
$min-width:320 !default; // Minimum width
$max-width:2560 !default; // Maximum width
// only run once
@Jesus
Jesus / config_files.rb
Last active February 21, 2021 10:44
Config. file uploader task for Capistrano 3
# lib/capistrano/tasks/config_files.cap
#
# Capistrano task to upload configuration files outside SCM
# Jesus Burgos Macia
#
# This allows us to have server's config files isolated from development ones.
# That's useful for several reasons, but the most important is that you can
# ignore files from repository.
#
# The task will upload all files found in