This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'after_setup_theme', 'bootstrap_setup' ); | |
if ( ! function_exists( 'bootstrap_setup' ) ): | |
function bootstrap_setup(){ | |
add_action( 'init', 'register_menu' ); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Sample code for sending MailChimp Email Campaigns from a Rails App using Gibbon API wrapper v0.3.5 | |
# All recipients must already be on the associated MailChimp list (list_id), for this app we add those via another | |
# API call every few minutes. | |
# | |
# Member function of EmailCampaign.rb model | |
# See http://labs.saidigital.co/using-mailchimp-api-to-send-email-campaigns-to-a-dynamic-set-of-email-addresses-425/ | |
# for explanation. | |
def send_campaign(api_key, gb, list_id, template_id, from_name, from_email) | |
self.reset_unique_id | |
segment_id = gb.list_static_segment_add(:id => list_id, :name => self.safe_name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($) { | |
// jQuery function to set a maximum length or characters for a page element it can handle mutiple elements | |
$.fn.createExcerpts = function(elems,length,more_txt) { | |
$.each($(elems), function() { | |
var item_html = $(this).html(); // | |
item_html = item_html.replace(/< /?[^>]+>/gi, ''); //replace html tags | |
item_html = jQuery.trim(item_html); //trim whitespace | |
$(this).html(item_html.substring(0,length)+more_txt); //update the html on page | |
}); | |
return this; //allow jQuery chaining |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$alpha_color: red; | |
$bravo_color: blue; | |
$charlie_color: green; | |
$color_names: alpha_color bravo_color charlie_color; | |
$color_vars: $alpha_color $bravo_color $charlie_color; | |
@each $name in $color_names { | |
$i: index($color_names, $name); | |
%#{$name} { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- example 1 --> | |
<li ng-class="$first ? 'firstRow' : 'nonFirstRow'">...</li> | |
<!-- example 2 --> | |
<li ng-class="{myClass: $first, anotherClass: $index == 2}">...</li> | |
<!-- example 3 --> | |
<li ng-style="{true: {color: 'red'}, false: {}}[$first]">...</li> | |
<!-- from: http://stackoverflow.com/questions/12008580/a-ternary-in-templates --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script src="https://rawgithub.com/ai/autoprefixer-rails/master/vendor/autoprefixer.js"></script> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
<style type="unprocessed" id="AutoprefixerIn">#output { | |
width: 307px; | |
height: 250px; | |
background: rgba(255,255,255,0.5); | |
border: 1px solid #ccc; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script src="https://rawgithub.com/ai/autoprefixer-rails/master/vendor/autoprefixer.js"></script> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
<style type="unprocessed" id="AutoprefixerIn">#output { | |
width: 307px; | |
height: 250px; | |
background: rgba(255,255,255,0.5); | |
border: 1px solid #ccc; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Simple HTML5 blog</title> | |
</head> | |
<body> | |
<main role="main"> | |
<header> | |
<h1>Simple <span>HTML5</span> blog</h1> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# bash function, usage: $ st -p [projectname] -opt2 -opt3 | |
function sublime() { | |
if [ -n "$1" -a -n "$2" ]; then # if more than one argument | |
if [ "$1" = "-p" -o "$1" = "--project" ]; then # if arg1 is -p or --project | |
local projectfile="$2" | |
[[ $projectfile != *.sublime-project ]] && projectfile="$2.sublime-project" # detect if arg2 already includes the ext | |
if [ -e $projectfile ]; then # does project file exist? | |
subl -n --project $projectfile ${*:3} # open project file, in new window, include trailing args | |
#echo "project specified, and project file exists, execute: subl -n --project $projectfile ${*:3}" | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// source code from: | |
// http://stackoverflow.com/questions/16310298/if-a-ngsrc-path-resolves-to-a-404-is-there-a-way-to-fallback-to-a-default | |
app.directive('img', function () { | |
return { | |
restrict: 'E', | |
link: function (scope, element, attrs) { | |
// show an image-missing image | |
element.bind('error', function () { | |
var w = element.width(); | |
var h = element.height(); |
OlderNewer