Skip to content

Instantly share code, notes, and snippets.

View wei-lee's full-sized avatar

Wei Li wei-lee

  • Intercom
  • Dublin, Ireland
View GitHub Profile
@wei-lee
wei-lee / CDVLocalStorage_createBackupInfoWithCloudBackup.m
Created July 28, 2014 10:06
disable the cordova ios library directory from backing up
+ (NSMutableArray*)createBackupInfoWithCloudBackup:(BOOL)cloudBackup
{
// create backup info from backup folder to caches folder
NSString* appLibraryFolder = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) objectAtIndex:0];
//added by WL: make sure no files will be backuped in the libaray dir!!
if (!cloudBackup) {
[self addSkipBackupAttributeToItemAtURL:[NSURL fileURLWithPath:appLibraryFolder] skip:!cloudBackup];
}
NSString* appDocumentsFolder = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSString* cacheFolder = [appLibraryFolder stringByAppendingPathComponent:@"Caches"];
@wei-lee
wei-lee / disable_backup.js
Created July 28, 2014 10:09
disable cordova ios file backup to iCloud
fileSystem.getFile( key, {create:true}, function( file ) {
if(typeof file.setMetadata === 'function' ){
file.setMetadata(function(){
writeContent(file, error);
}, function(){
writeContent(file, error);
}, {'com.apple.MobileBackup': 1});
} else {
writeContent(file, error);
}
@wei-lee
wei-lee / lawnchair_html5_filesystem_updated.js
Last active August 29, 2015 14:04
lawnchair html5-filesystem adapter - disable icloud backup on ios
Lawnchair.adapter('html5-filesystem', (function (global) {
var FileError = global.FileError;
var fail = function (e) {
var msg;
var show = true;
switch (e.code) {
case FileError.QUOTA_EXCEEDED_ERR:
@wei-lee
wei-lee / gist:444c9ab43b208a97caf8
Last active August 29, 2015 14:04
Business Object Versioning Survey
{
"name" : "Wei",
"cluster" : false,
"cluster.reseller" : false,
"cluster.reseller.customer" : false,
"cluster.reseller.customer.domain" : false,
"cluster.reseller.customer.domain.project" : true,
"cluster.reseller.customer.domain.project.client-apps" : true,
"cluster.reseller.customer.domain.project.client-apps.documentation" : true,
"cluster.reseller.customer.domain.project.client-apps.source-code" : true,
#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
green='\033[0;32m'
@wei-lee
wei-lee / signing
Created December 8, 2014 12:45
Generate signing credentials for Android release
# Step 1: Generate the keystore file.
# If a keystore file already exists, skip this.
keytool -genkey -v -keystore my-release-key.keystore -alias dev -keyalg RSA -keysize 2048 -validity 10000
# Need to remember the password for the keystore file
# Step 2: convert the keystore file to PKCS12 format
keytool -importkeystore -srckeystore ./my-release-key.keystore -destkeystore newkeystore.p12 -deststoretype PKCS12 -srcalias dev
# Step 3: Upload the .p12 file as both the private key file and certificate file to the AppStudio as 1 credential bundle
{
"name": "dev",
"description": "Development role",
"json_class": "Chef::Role",
"default_attributes": {
"host_src_dir": "/Users/weili/work/fh/eng/",
"feedhenry_common": {
"src": "/mnt/src"
},
"vm": {
Org::Instances:bootstrap = ppa4
Loading config: /Users/weili/work/fh/chef/fhcap-dev/organisations/ppa4.json
The available chef servers are:
You are about to run this cmd using your currently configured knife settings, continue? yes
/Users/weili/work/fh/chef/fhcap2/lib/fhcap/s3_helper.rb:93:in `require': cannot load such file -- aws/s3 (LoadError)
from /Users/weili/work/fh/chef/fhcap2/lib/fhcap/s3_helper.rb:93:in `_get_aws_config'
from /Users/weili/work/fh/chef/fhcap2/lib/fhcap/aws_helper.rb:33:in `_get_ec2_client'
from /Users/weili/work/fh/chef/fhcap2/lib/fhcap/aws/ec2/instances.rb:13:in `find_instance'
from /Users/weili/work/fh/chef/fhcap2/lib/tasks/org_instances.thor:127:in `block (2 levels) in bootstrap'
from /Users/weili/work/fh/chef/fhcap2/vendor/bundle/ruby/2.1.0/gems/celluloid-0.16.0/lib/celluloid/calls.rb:26:in `call'
enerated at 2015-07-01 15:47:06 +0000
Mixlib::ShellOut::ShellCommandFailed: package[libcurl4-openssl-dev] (gitlab-shell::default line 19) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '100'
---- Begin output of apt-get -q -y install libcurl4-openssl-dev=7.22.0-3ubuntu4.14 ----
STDOUT: Reading package lists...
Building dependency tree...
Reading state information...
The following packages were automatically installed and are no longer required:
git-man liberror-perl
Use 'apt-get autoremove' to remove them.
Suggested packages:
async.waterfall(
[
function getVariants(callback){
//get variants, pass them to the callback
return callback(null, variants);
},
function(variants, callback){
//if variants is an array, you can nest more async functions
async.map(variants, function(variant, cb){
//create variant