Skip to content

Instantly share code, notes, and snippets.

View calendee's full-sized avatar

Calendee LLC calendee

View GitHub Profile
@remy
remy / gist:350433
Created March 31, 2010 14:58
Storage polyfill
if (typeof window.localStorage == 'undefined' || typeof window.sessionStorage == 'undefined') (function () {
var Storage = function (type) {
function createCookie(name, value, days) {
var date, expires;
if (days) {
date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
expires = "; expires="+date.toGMTString();
@aaronksaunders
aaronksaunders / controllers.js
Last active November 9, 2018 04:51
Accessing MongoDB Example Ionic Framework - based on hello sample
angular.module('starter.controllers', [])
.controller('DashCtrl', function ($scope) {
})
.controller('FriendsCtrl', function ($scope, Friends) {
Friends.init()
.then(function (_data) {
console.log(_data.data.deployment_id);
Friends.all().then(function (_data) {
@JoeKeikun
JoeKeikun / input_cursor_color
Last active June 7, 2022 12:08
How to change <input> input cursor color by css (webkit)
When I developed an app for ios by phonegap, I had a trouble in changing the <input> input cursor color.
but now, there is a solution for it:
---------------
<style>
input {
color: rgb(60, 0, 248); /* change [input cursor color] by this*/
text-shadow: 0px 0px 0px #D60B0B; /* change [input font] by this*/
-webkit-text-fill-color: transparent;
@aleks-mariusz
aleks-mariusz / safari-open-pages.py
Created August 24, 2014 16:35
This script fetches the current open tabs in all Safari windows. Useful to run remotely on your mac when you are at work and want to read a page you have open (remotely) at home but don't remember the url but can log in to your home system on the command line
#!/usr/bin/python
#
# This script fetches the current open tabs in all Safari windows.
# Useful to run remotely on your mac when you are at work and want
# to read a page you have open (remotely) at home but don't remember
# the url but can log in to your home system on the cmmand line
#
import sys
@calendee
calendee / scope-getting.js
Last active February 15, 2017 17:16
Fire Angular RootScope Event from Console, Get Get An AngularJS service
// Right click an element and select "Inspect Element"
// Courtesy : http://michalostruszka.pl/blog/2013/09/24/angularjs-in-browsers-console/ &
// http://ionicframework.com/blog/angularjs-console/
var scope = angular.element($0).scope();
var rootScope = scope.$root
scope.$apply( function() {
rootScope.$broadcast('showOffline', {msg : 'goes here', duration : 1230});
})
@calendee
calendee / watchCount.js
Created December 14, 2015 19:21
Count AngularJS Watches
(function countAngularWatchers(angular) {
var i, data, scope,
count = 0,
all = document.all,
len = all.length,
test = {};
var mostWatchers = 0;
function countScopeWatchers(scope, element) {
@xxxxlr
xxxxlr / React-Native-WebView-Cookies.js
Created July 27, 2017 01:10 — forked from kanzitelli/React-Native-WebView-Cookies.js
React Native Trick: Get Cookies of WebView without using any native modules such as react-native-cookies. Might be helpful for getting JWT while making OAuth2 👽
// @flow
import React, { Component } from 'react';
import {
WebView,
} from 'react-native';
class LoginScreen extends Component {
state = {
cookies : {},
@calendee
calendee / change-network.js
Created November 3, 2017 15:09
Forcing App to Change Network Status
var app = document.getElementsByTagName('body');
var scope = angular.element(app[0]).scope();
var rootScope = scope.$root
// Make app think you're offline
scope.$apply( function() {
rootScope.$broadcast('$cordovaNetwork:offline');
});
// Make app think you're online
@calendee
calendee / .bash_profile
Last active May 14, 2021 23:29
NVM Automatic Switching
# NVM version shortcut
# change title name of tab in terminal
function title {
    echo -ne "\033]0;"$*"\007"
}
cd() {
  builtin cd "$@" || return
  #echo $PREV_PWD
  if [ "$PWD" != "$PREV_PWD" ]; then
function Mutilator(data, name, context) {
this.n = name || `mutilation-${+new Date()}`;
this.d = data;
this.c = context || window;
this.isArr = function(p) {
return this.d[p].constructor == Array;
};
this.dispatch = function(p, v, t) {
this.c.dispatchEvent(
new CustomEvent(this.n, {