Skip to content

Instantly share code, notes, and snippets.

/**
* jQuery alterClass plugin
*
* Remove element classes with wildcard matching. Optionally add classes:
* $( '#foo' ).alterClass( 'foo-* bar-*', 'foobar' )
*
* Copyright (c) 2011 Pete Boere (the-echoplex.net)
* Free under terms of the MIT license: http://www.opensource.org/licenses/mit-license.php
*
*/
@Rakonda
Rakonda / Less-snippets.less
Created January 21, 2015 15:46
This is a sample less snippets, very useful when it comes to some of CSS3 aspects.
/* Less snippets */
.text-shadow (@string: 0 1px 3px rgba(0, 0, 0, 0.25)) {
text-shadow: @string;
}
.box-shadow (@string) {
-webkit-box-shadow: @string;
-moz-box-shadow: @string;
box-shadow: @string;
}
'use strict';
angular.module('yourApp')
.directive 'file', [ () ->
restrict: "E"
template: "<input type=\"file\" />"
replace: true
require: "ngModel"
link: (scope, element, attr, ctrl) ->
listener = ->
@Rakonda
Rakonda / svg2png.js
Created October 22, 2015 22:14 — forked from gustavohenke/svg2png.js
SVG to PNG
var svg = document.querySelector( "svg" );
var svgData = new XMLSerializer().serializeToString( svg );
var canvas = document.createElement( "canvas" );
var ctx = canvas.getContext( "2d" );
var img = document.createElement( "img" );
img.setAttribute( "src", "data:image/svg+xml;base64," + btoa( svgData ) );
img.onload = function() {
@Rakonda
Rakonda / app.js
Created December 15, 2015 15:11 — forked from jdnichollsc/app.js
Service with Angular.js in Ionic Framework to get Products from Web Service or Local Storage using Promises and ngCordova
var app = angular.module('demo', ['ionic', 'ngCordova', 'demo.controllers', 'demo.services']);
var controllers = angular.module('demo.controllers', []);
var services = angular.module('demo.services', []);
@Rakonda
Rakonda / image-service.js
Created December 30, 2015 16:19 — forked from transitive-bullshit/image-service.js
Angular service to resize images with antialiasing for use with canvas.
angular.module('demo').service('imageService', function ($http, $q, $timeout) {
var NUM_LOBES = 3
var lanczos = lanczosGenerator(NUM_LOBES)
// resize via lanczos-sinc convolution
this.resize = function (img, width, height) {
var self = { }
self.type = "image/png"
self.quality = 1.0
@Rakonda
Rakonda / app.js
Last active February 6, 2016 23:00
Angular ng-repeat in reverse
var app = angular.module('demo-reverse', []);
app.controller('itemsCtrl', function ($scope) {
$scope.items_array = ['1', '2', '3', '4', '5', '6'];
});
@Rakonda
Rakonda / IonicCordovaNetwork.js
Created May 18, 2016 16:01 — forked from welcoMattic/IonicCordovaNetwork.js
Async navigator.connection.type service for Ionic Framework
var myApp = angular.module('myApp').service('CordovaNetwork', ['$ionicPlatform', '$q', function($ionicPlatform, $q) {
// Get Cordova's global Connection object or emulate a smilar one
var Connection = window.Connection || {
"CELL" : "cellular",
"CELL_2G" : "2g",
"CELL_3G" : "3g",
"CELL_4G" : "4g",
"ETHERNET" : "ethernet",
"NONE" : "none",
"UNKNOWN" : "unknown",
@Rakonda
Rakonda / rAF.js
Created July 25, 2016 16:40 — forked from paulirish/rAF.js
requestAnimationFrame polyfill
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
@Rakonda
Rakonda / ion-tabs-swipable.js
Created November 8, 2016 09:45 — forked from taivo/ion-tabs-swipable.js
Swipe navigation for ion-tabs (for ionic framework v 1.0.0)
angular.module('yourModule')
.directive('tabsSwipable', ['$ionicGesture', function($ionicGesture){
//
// make ionTabs swipable. leftswipe -> nextTab, rightswipe -> prevTab
// Usage: just add this as an attribute in the ionTabs tag
// <ion-tabs tabs-swipable> ... </ion-tabs>
//
return {
restrict: 'A',
require: 'ionTabs',