Skip to content

Instantly share code, notes, and snippets.

View MehulATL's full-sized avatar

Mehul Patel MehulATL

View GitHub Profile
@MehulATL
MehulATL / cards.css
Created May 12, 2015 19:57
ionic cards css
.card, .list-inset {
overflow: hidden;
margin: 20px 10px;
border-radius: 2px;
background-color: #fff; }
.card {
padding-top: 1px;
padding-bottom: 1px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); }
var BackButtonCtrl = function ($scope, $log, $state, $ionicHistory, $ionicViewSwitcher) {
var ctrl = this;
/**
* Checks to see if there is a view to navigate back to
* if we have no current back view.
*
* @param {string} state The current view state
* @return {boolean} If there is a view we should navigate back to
var rect;
var map;
var info;
var bounds = {};
var showNewRect = function(e) {
// var nw = rect.getBounds().getNorthWest();
var ne = rect.getBounds().getNorthEast();
var sw = rect.getBounds().getSouthWest();
@MehulATL
MehulATL / pn.js
Created November 20, 2014 04:36
pn abstraction
angular.module('keychain.services.pn', [])
.factory('PN', function($rootScope, $q, PubNub, User) {
return {
publish: function(channel, body) {
console.log('Publishing to', channel);
var dfd = $q.defer();
@MehulATL
MehulATL / nav-clear.js
Created November 7, 2014 22:04
programatic version of ionic's nav-clear directive
var unregisterListener = $rootScope.$on('$stateChangeStart', function() {
$ionicViewService.nextViewOptions({
disableBack: true
});
unregisterListener();
});
$window.setTimeout(unregisterListener, 300);
$state.go('someState');
@MehulATL
MehulATL / safeApply.js
Created November 6, 2014 23:00
safeApply()
var safeApply = function (fn) {
var phase = $rootScope.$root.$$phase;
if (phase === '$apply' || phase === '$digest') {
if (fn && typeof fn === 'function') {
fn();
}
} else {
$rootScope.$apply(fn);
}
};
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
127.0.0.1 localhost.com
127.0.0.1 api.localhost
@MehulATL
MehulATL / .gitconfig
Created October 22, 2014 19:35
git config
[user]
name = Mehul Patel
email = [email protected]
[color]
ui = true
[alias]
co = checkout
ci = commit
st = status
br = branch
@MehulATL
MehulATL / subl
Last active August 29, 2015 14:08
subl
sudo ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/bin/subl
@MehulATL
MehulATL / currency.directive.js
Last active August 29, 2015 14:07
currencyMask directive for input fields
angular.module('currencyMask', [])
.directive('currencyMask', function () {
return {
restrict: 'A',
require: 'ngModel',
link: function (scope, element, attrs, ngModelController) {
// Run formatting on keyup
var numberWithCommas = function(value, addExtraZero) {