Skip to content

Instantly share code, notes, and snippets.

View royts's full-sized avatar

Roy Tsabari royts

View GitHub Profile
{
"name": "dev",
"version": "0.0.0",
"dependencies": {
"gulp": {
"version": "3.8.10",
"from": "gulp@^3.8.8",
"resolved": "https://registry.npmjs.org/gulp/-/gulp-3.8.10.tgz",
"dependencies": {
"archy": {
@royts
royts / gist:9c251737e12d83a45582
Last active August 10, 2017 05:36
JavaScript Puzzle
// We need to create a chat client.
// The messages pulling policy to should be:
// 1. Get the latest messages from the server
// 2. Wait 2 sec.
// 3. Back to no. 1 again
// Q: what is wrong with the following solution?
// What would be the right way to do that?
CSS:
======
<div class="kpi-boxes">
<div class="kpi-box kpi-first">
</div>
<div class="kpi-box">
@royts
royts / gist:5894780
Created June 30, 2013 11:08
Small changes in @simpulton chosen.js deirective for AngularJS (https://github.com/simpulton/angular-chosen)
module.directive('angularChosen', function () {
return {
restrict: 'A',
require: '?ngModel',
link: function (scope, element, attrs) {
scope.$watch(attrs.ngModel, function () {
element.trigger('liszt:updated');
@royts
royts / gist:5843967
Last active December 18, 2015 20:59
AngularJS CSS lazy loading - first version. Ream more here: http://www.royts.com/2013/06/css-lazy-loading-in-angularjs-app.html
angular.module('cssLoadingService', []).factory("CssLoadingService", function () {
return {
loadCss: function (url) {
if (document.createStyleSheet) {
document.createStyleSheet(url); //IE
} else {
var link = document.createElement("link");
link.type = "text/css";
link.rel = "stylesheet";
link.href = url;