Skip to content

Instantly share code, notes, and snippets.

~/work/cheetah (lifecycle *) $ make serve
[default] VM already created. Booting if it's not already running...
/opt/ruby/lib/ruby/gems/1.9.1/gems/bundler-1.2.1/lib/bundler/spec_set.rb:90:in `block in materialize': Could not find i18n-0.6.4 in any of the sources (Bundler::GemNotFound)
from /opt/ruby/lib/ruby/gems/1.9.1/gems/bundler-1.2.1/lib/bundler/spec_set.rb:83:in `map!'
from /opt/ruby/lib/ruby/gems/1.9.1/gems/bundler-1.2.1/lib/bundler/spec_set.rb:83:in `materialize'
from /opt/ruby/lib/ruby/gems/1.9.1/gems/bundler-1.2.1/lib/bundler/definition.rb:113:in `specs'
from /opt/ruby/lib/ruby/gems/1.9.1/gems/bundler-1.2.1/lib/bundler/definition.rb:158:in `specs_for'
from /opt/ruby/lib/ruby/gems/1.9.1/gems/bundler-1.2.1/lib/bundler/definition.rb:147:in `requested_specs'
from /opt/ruby/lib/ruby/gems/1.9.1/gems/bundler-1.2.1/lib/bundler/environment.rb:23:in `requested_specs'
from /opt/ruby/lib/ruby/gems/1.9.1/gems/bundler-1.2.1/lib/bundler/runtime.rb:11:in `setup'
@hunterloftis
hunterloftis / gist:5515427
Last active December 16, 2015 23:39
Using filters programmatically in a custom directive
// current (works)
<div ng-repeat='movie in movies.titles | subcategories:categoryList()'>
// goal:
<div ng-repeat='filteredMovies()'>
link: function(scope, element, attrs) {
scope.filteredMovies = function() {
@hunterloftis
hunterloftis / gist:5527759
Created May 6, 2013 20:08
carousel attempt #1
app.directive('carousel', function() {
var HEIGHT = 321;
var SPACING = 12;
var template = "\
<div class='carousel-container'>\
<h1 class='carousel-title'>{{movies.carouselTitle}}</h1>\
<div class='carousel'>\
<div class='carousel-slider'>\
@hunterloftis
hunterloftis / gist:5527881
Created May 6, 2013 20:23
subcategories filter
app.filter('subcategories', function() {
return function(movies, categories) {
var matching = [];
_.each(movies, function(movie) {
var missingTags = (_.difference(categories, movie.subcategoryList).length > 0);
if (!missingTags) matching.push(movie);
});
$scope.$on('details', function(event, args) {
console.log('location.path:', $location.path()); // outputs "/"
//document.location.hash = '/details/123'; // works
//$location.path('/details/123'); // doesn't work
$location.path('details/123'); // doesn't work
});
.on('click', function() {
scope.$apply(function() {
scope.$emit('details', { url: scope.movie.mobileDetailsLinkUrl });
});
})
.directive('sdwTopbarLeft', function() {
return {
restrict: 'EA',
require: '^sdwTopbar',
transclude: true,
template: '<div class="sdw-topbar-left" ng-transclude></div>',
link: topbarLeftLink
};
function topbarSideLink(scope, element, attrs, controller) {
<html ng-app='testApp'>
<body ng-controller='testController'>
<button ng-click='test()'>Menu</button>
<my-custom-directive id='needToAccess'></my-custom-directive>
</body>
<script>
angular
.module('testApp', [])
.controller('testController', function($scope) {
angular
.module('skookum.mobile.feeditem', [])
.directive('sdwFeeditem', function($compile) {
return {
restrict: 'EA',
require: 'sdwFeeditem',
controller: feeditemController,
link: feeditemLink,
replace: true,
angular
.module('test.routes', ['ui.state'])
.config(function($routeProvider, $stateProvider) {
// automatically redirect to #/test
$routeProvider
.otherwise({ redirectTo: '/test' });