Skip to content

Instantly share code, notes, and snippets.

View tcdevs's full-sized avatar

TC Devs tcdevs

  • Technische Centrale
View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<meta name="description" />
<meta charset=utf-8 />
<title>Angular Tree</title>
</head>
<body ng-app="myApp" ng-controller="myController">
<ul ng-tree="family">
<li select="selected()">{{item.name}}</li>
@tcdevs
tcdevs / orderBy.js
Created October 16, 2013 11:57
ng-repeat orderBy multiple attributes
//JSFiddle eaxample - http://jsfiddle.net/JSWorld/Hp4W7/32/
orderBy:['group','sub']
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)
@tcdevs
tcdevs / iframe.js
Created October 29, 2013 15:49
Prevent your website being displayed inside IFRAME
//Prevent your website being displayed inside IFRAME
//http://roshanbh.com.np/2008/06/prevent-website-displayed-inside-iframe.html
if (top.location.href != self.location.href)
top.location.href = self.location.href;
Date.prototype.getWeek = function() {
var onejan = new Date(this.getFullYear(),0,1);
return Math.ceil((((this - onejan) / 86400000) + onejan.getDay()+1)/7);
}
var today = new Date();
var weekno = today.getWeek();
var app = angular.module('app', []);
app.directive('yaTree', function () {
return {
restrict: 'A',
transclude: 'element',
priority: 1000,
terminal: true,
compile: function (tElement, tAttrs, transclude) {
myApp.directive('switchButton', function() {
return {
require: 'ngModel',
restrict: 'E',
template: '<div class="btn-group">' +
'<button class="btn on" ng-click="on()"></button>' +
'<button class="btn off" ng-click="off()"></button>' +
'</div>',
link: function($scope, element, attrs, controller) {
$scope.on = function() {
img.grayscale.disabled {
filter: url("data:image/svg+xml;utf8,&lt;svg xmlns=\'http://www.w3.org/2000/svg\'&gt;&lt;filter id=\'grayscale\'&gt;&lt;feColorMatrix type=\'matrix\' values=\'1 0 0 0 0, 0 1 0 0 0, 0 0 1 0 0, 0 0 0 1 0\'/&gt;&lt;/filter&gt;&lt;/svg&gt;#grayscale");
-webkit-filter: grayscale(0%);
}
<!DOCTYPE html>
<html>
<head>
<meta charset='UTF-8' />
<link rel='stylesheet' href='style.css' />
</head>
<body>
<form id="myform">
<input type="text" name="login" id="login" />