Skip to content

Instantly share code, notes, and snippets.

View devgeeks's full-sized avatar

tommy-carlos williams devgeeks

View GitHub Profile
@devgeeks
devgeeks / icons.js
Created May 14, 2013 23:51
icons.js hook in after_prepare (could be better in after_platform_add)
#!/usr/bin/env node
(function() {
var projectName = 'SpiderOak',
fs = require('fs'),
path = require('path'),
res = path.join('.', 'www', 'res', 'icon'),
androidDest = path.join('.', 'platforms', 'android', 'res'),
iOSDest = path
.join('.', 'platforms', 'ios', projectName, 'Resources', 'icons');
@devgeeks
devgeeks / component.json
Created April 20, 2013 14:45
Example of using bower to just get the file you want, not everything else...
{
"name": "MyExampleApp",
"version": "0.1.0",
"dependencies": {
"jquery": "http://code.jquery.com/jquery-1.9.1.min.js"
}
}
@devgeeks
devgeeks / example-download-and-open.js
Last active January 17, 2023 15:17
Example file download and open in Cordova inAppBrowser
window.requestFileSystem(LocalFileSystem.TEMPORARY, 0, gotFS, fail);
function fail(error) {
console.log(error)
}
function gotFS(fileSystem) {
fileSystem.root.getDirectory("data", {create: true, exclusive: false}, gotDir, fail);
}
/*
* object.watch polyfill
*
* 2012-04-03
*
* By Eli Grey, http://eligrey.com
* Public Domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/
@devgeeks
devgeeks / gist:4600088
Created January 22, 2013 23:53
A two second hack fix for the menusheet extension allowing scrolling of the entire container when open
// Hax fix for container scrolling while menusheet is open.
$('#jqt').on('scroll', function (e) {
// Snap back if not after about the half way point...
if (this.scrollLeft < ($(window).width() / 4)) {
this.scrollLeft = 0;
}
// Or close if it is...
else {
$('#menusheet').menusheet('hide');
}
@devgeeks
devgeeks / raised-tabbar-snippet.m
Created December 2, 2012 09:23
Snippet needed to add a raised TabBar button in PhoneGap to the TabBar or NativeControls plugin on iOS
UIImage* buttonImage = [UIImage imageNamed:@"aperture-tab.png"];
UIButton* button = [UIButton buttonWithType:UIButtonTypeCustom];
button.frame = CGRectMake(0.0, 0.0, buttonImage.size.width, buttonImage.size.height);
[button setBackgroundImage:buttonImage forState:UIControlStateNormal];
[button setBackgroundImage:buttonImage forState:UIControlStateHighlighted];
CGFloat heightDifference = buttonImage.size.height - tabBar.frame.size.height;
CGPoint center = tabBar.center;
@devgeeks
devgeeks / generate-policy.rb
Created November 28, 2012 05:11
S3 direct upload policy generator
require 'base64'
require 'openssl'
require 'digest/sha1'
policy_document = '{"expiration": "2015-01-01T00:00:00Z",
"conditions": [
{"bucket": "BUCKET_NAME_HERE"},
["starts-with", "$key", "FOLDER_NAME_HERE/"],
{"acl": "public-read"},
["starts-with", "$Content-Type", "image/"],
@devgeeks
devgeeks / s3-phonegap-upload.js
Created November 27, 2012 19:47
S3 direct upload
var options = new FileUploadOptions();
options.fileKey="fileupload";
var time = new Date().getTime();
var userId = getUserId(); // In my case, Parse.User.current().id;
var fileName = userId+"-"+time+".jpg";
options.fileName = fileName;
options.mimeType ="image/jpeg";
options.chunkedMode = false;
var uri = encodeURI("https://BUCKET_NAME.s3.amazonaws.com/");
@devgeeks
devgeeks / meta-data-config.md
Created November 23, 2012 00:00
BugHerd meta data configuration API

The BugHerd sidebar can be configured to override some of its default behaviour as well as display extra information in any tasks that you pass in from a configuration object called BugHerdConfig.

When setting up BugHerd for the first time, you probably already know you need to add the following code to your site:

  <script type="text/javascript">
    (function (d, t) {
      var bh = d.createElement(t), s = d.getElementsByTagName(t)[0];
      bh.type = 'text/javascript';
      bh.src = '//www.bugherd.com/sidebarv2.js?apikey=YOUR-API-KEY-HERE';
@devgeeks
devgeeks / bugherd-config-api-rfc.md
Created October 19, 2012 01:44
RFC - BugHerd Configuration API

This is a request for comment - this is a proposed configuration API for the BugHerd Public Feedback and Sidebar

The BugHerd sidebar can be configured to override some of its default behaviour as well as display extra information in any tasks that you pass in from a configuration object called BugHerdConfig.

When setting up BugHerd for the first time, you probably already know you need to add the following code to your site:

  <script type="text/javascript">
    (function (d, t) {
      var bh = d.createElement(t), s = d.getElementsByTagName(t)[0];