Skip to content

Instantly share code, notes, and snippets.

<!doctype html>
<html ng-app="MyApp" >
<head>
<script src="http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.1.1/angular.js"></script>
<script type="text/javascript">
var app = angular.module('MyApp', []);
app.directive('colorpicker', function($parse) {
// sample color picker directive
// todo : bound to a ng-model
angular.module('list.controllers', [])
.controller('SingleListCtrl', [
'$scope',
'$routeParams',
'$location',
'Lists',
'Products',
'Timestamp',
function($scope, $routeParams, $location, Lists, Products, Timestamp) {
console.log("SingleListCtrl : ", $routeParams.list_id);
angular.module('list.directives', [])
.directive('uiProducts', function($compile) {
return {
restrict: 'E',
replace: true,
transclude: true,
template: '<table>' +
'<tbody ng-repeat="category in categories">' +
'<tr ng-class="{purchased: category.purchased}">' +
'<td ng-class="{category: category.purchased}" colspan="4">' +
@Petrlds
Petrlds / controller.js
Last active December 17, 2015 20:59
Angular delete resource doesn't use params and doesn't work in a right way
angular.module('lists.controllers', []).
controller('ListsCtrl', ['$rootScope', '$scope', 'Lists', '$dialog', function($rootScope, $scope, Lists, $dialog) {
console.log("dialog : ", $dialog);
$scope.list_filter = 'all';
$scope.isCurrentListFilter = function(filter) {
return $scope.list_filter == filter;
};
$scope.isNotMyList = function(owner) {
return $rootScope.current_user._id != owner._id;
@Petrlds
Petrlds / enter-update-remove-transitions.html
Created November 9, 2012 11:45
D3 transitions on enter/update/remove
<!DOCTYPE html>
<html>
<head>
<title></title>
<!--<link href="css/nv.d3.css" rel="stylesheet">-->
<script src="lib/d3.v2.js" type="text/javascript" charset="utf-8"></script>
<!--<script src="lib/nv.d3.js" type="text/javascript" charset="utf-8"></script>-->
<style>
#chart svg {
height: 500px;
@Petrlds
Petrlds / update-transition.html
Created November 9, 2012 08:27
D3 simple update transition of circles
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
<!--<link href="css/nv.d3.css" rel="stylesheet">-->
<script src="lib/d3.v2.js" type="text/javascript" charset="utf-8"></script>
<!--<script src="lib/nv.d3.js" type="text/javascript" charset="utf-8"></script>-->
<style>
#chart svg {
@Petrlds
Petrlds / all_facets.js
Created August 15, 2012 08:04
List of facets
// in routers/App.bones initializeState
this.schemas = new models.Schemas();
this.schemas.fetch()
.then(function(schemas) {
that.schemas = schemas;
});
// this is to place in router function
$.when(this.schemas).then(function(schemas) {
@Petrlds
Petrlds / views_refactor.js
Created July 27, 2012 08:46
Views refactor
Interface {
changeStack(); // event listener, when a card in a stack is another stack
showStack(stack);
}
Stack {
showCard();
nextCard();
finish();
}