Skip to content

Instantly share code, notes, and snippets.

Avatar

Young K. Park ozexpert

  • UI / UX
  • Earth
View GitHub Profile
@ozexpert
ozexpert / ionic2.image-cache.directive.ts
Last active Mar 21, 2018
AngularJS2 / Ionic2 : ImageCache Directive to use with imgcache.js
View ionic2.image-cache.directive.ts
import { Directive, ElementRef, Input } from '@angular/core';
declare var ImgCache: any;
@Directive({
selector: '[image-cache]'
})
export class ImageCacheDirective {
constructor (
private el: ElementRef
@ozexpert
ozexpert / fabfile.py
Last active Aug 29, 2015
Useful fabric to use with Ionic / Cordova application
View fabfile.py
from fabric.api import local, settings
from fabric.colors import red, green, yellow
from fabric.contrib.console import prompt
PACKAGE_NAME = 'YourProjectName'
DROPBOX_LOCATION = '~/Dropbox/YourLocation/'
BUILDER = 'YourId'
KEYSTORE = '~/someLocation/%(builder)s.keystore' % {'builder': BUILDER}
APK_LOCATION = 'platforms/android/bin/'
View screenshots.js
/*
* Takes provided URL passed as argument and make screenshots of this page with several viewport sizes.
* These viewport sizes are arbitrary, taken from iPhone & iPad specs, modify the array as needed
*
* Usage:
* $ casperjs screenshots.js http://example.com
*/
var casper = require("casper").create();
@ozexpert
ozexpert / cordovaReadyFactory.js
Created Feb 28, 2014
Super useful cordova ready factory (same as device ready in Cordova)
View cordovaReadyFactory.js
YourModule.factory('CordovaReady', function() {
return function (fn) {
var queue = [];
var impl = function () {
queue.push(Array.prototype.slice.call(arguments));
};
document.addEventListener('deviceready', function () {
queue.forEach(function (args) {
@ozexpert
ozexpert / notificationFactory.js
Last active Aug 29, 2015
AngularJS / Cordova Notification Service for device & web (Cordova Ver 3.3.0)
View notificationFactory.js
YourModule.factory('Notification', function($rootScope){
return {
alert: function(message, callback){
if(navigator.notification !== undefined){
navigator.notification.alert(message,
function(){
$rootScope.$apply(callback());
});
} else {
alert(message);