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
// in function.php | |
// Modify Responses WP Rest Api | |
add_action( 'rest_api_init', 'featured_image_thumbnail_url' ); | |
// Modifying Responses | |
function featured_image_thumbnail_url() { | |
// More info http://v2.wp-api.org/extending/modifying/ | |
register_api_field( |
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
angular.module('ymusica').controller('AlbumSearch', ['$scope', 'Albums', 'Artists', '$q', function($scope, albums, artists, $q) { | |
$scope.albums = []; | |
$scope.artists = []; | |
var terms = new Rx.Subject(); | |
$scope.searchMusic = terms.onNext.bind(terms); | |
terms.sample(250) |
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: <img ng-src="image-url.jpg" class="horizontal" orientable /> | |
app.directive('orientable', function () { | |
return { | |
link: function(scope, element, attrs) { | |
element.bind("load" , function(e){ | |
// success, "onload" catched | |
// now we can do specific stuff: | |
if(this.naturalHeight > this.naturalWidth){ | |
this.className = "vertical"; | |
} |
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(); |
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
<!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
<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
<!-- 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
$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} { |
NewerOlder