Skip to content

Instantly share code, notes, and snippets.

View install phantomjs 2.1.1 - ubuntu
sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev -y
sudo apt-get install libfreetype6 libfreetype6-dev -y
sudo apt-get install libfontconfig1 libfontconfig1-dev -y
cd ~
export PHANTOM_JS="phantomjs-2.1.1-linux-x86_64"
wget https://github.com/Medium/phantomjs/releases/download/v2.1.1/$PHANTOM_JS.tar.bz2
sudo tar xvjf $PHANTOM_JS.tar.bz2
sudo mv $PHANTOM_JS /usr/local/share
sudo ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin
@Mauricevb
Mauricevb / cloudkit-server.php
Created Feb 7, 2016
CloudKit server-to-server in PHP
View cloudkit-server.php
<?php
// Constants
$KEY_ID = 'YOUR_KEY_ID';
$CONTAINER = 'YOUR_CONTAINER';
$PRIVATE_PEM_LOCATION = 'eckey.pem'; // Store this file outside the public folder!
// Config
$url = 'https://api.apple-cloudkit.com/database/1/' . $CONTAINER . '/development/public/records/query';
$body = '{"query":{"recordType":"Articles"}}';
@joashp
joashp / PushNotifications.php
Last active Jun 4, 2020
Simple PHP script to send Android Push Notification, iOS Push Notification and Windows Phone 8 Push Notification
View PushNotifications.php
<?php
// Server file
class PushNotifications {
// (Android)API access key from Google API's Console.
private static $API_ACCESS_KEY = 'AIzaSyDG3fYAj1uW7VB-wejaMJyJXiO5JagAsYI';
// (iOS) Private key's passphrase.
private static $passphrase = 'joashp';
// (Windows Phone 8) The name of our push channel.
private static $channelName = "joashp";
@dbankier
dbankier / gist:c0e15ff0babaa878112f
Created May 8, 2014
Add copyright/license note to the top of all js files
View gist:c0e15ff0babaa878112f
find . -type f | grep -v node_modules | grep -v modules | grep -v .git | grep -v .json | grep .js | xargs -I{} perl -pi -e 'print "/*\n * Copyright (c) 2011-2014 YY Digital Pty Ltd. All Rights Reserved.\n * Please see the LICENSE file included with this distribution for details.\n */\n\n" if $. == 1' {}
@Rogichi
Rogichi / app.js
Last active Dec 19, 2015
Tweet Example (Using VIEZEL Codebird for Appcelerator Titanium. Twitter API 1.1 https://gist.github.com/viezel/5781083 ):
View app.js
// How Publish a Tweet (Titanium)
// Full Codebird API is here: https://github.com/mynetx/codebird-js
// Codebird for Appcelerator Titanium. Using the Twitter API 1.1: https://gist.github.com/viezel/5781083
//THANKS VIEZEL
@viezel
viezel / app.js
Last active Jun 15, 2020
Codebird for Appcelerator Titanium. Using the Twitter API 1.1
View app.js
// This is an example of use.
// Here we use the new Bearer Token thats make it possible to get tweets without user login
// More info on Bearer here: https://dev.twitter.com/docs/auth/application-only-auth
// Full Codebird API is here: https://github.com/mynetx/codebird-js
var Codebird = require("codebird");
var cb = new Codebird();
cb.setConsumerKey('CONSUMER_KEY', 'CONSUMER_SECRET_KEY');
var bearerToken = Ti.App.Properties.getString('TwitterBearerToken', null);
@tsteur
tsteur / alloy.jmk
Last active Nov 8, 2017
Simple build configuration file for Titanium Mobile Alloy to remove unimportant log calls if build type is production
View alloy.jmk
function isProduction(alloyConfig)
{
return 'production' == alloyConfig.deploytype;
}
function removeUnimportantLogCallsFromContent(content)
{
if (!content) {
return;
}
@josheinstein
josheinstein / gist:5586469
Last active Dec 27, 2019
Handle back button issues with Twitter Bootstrap's tab component.
View gist:5586469
// Handle back button issues with Twitter Bootstrap's tab component.
// Based on: http://stackoverflow.com/a/10120221/81769
// It has been changed to avoid the following side effects:
// - Switching tabs was being added to navigation history which is undesirable
// (Worked around this by using location.replace instead of setting the hash property)
// - Browser scroll position was lost due to fragment navigation
// (Worked around this by converting #id values to #!id values before navigating.)
$(document).ready(function () {
if (location.hash.substr(0,2) == "#!") {
@kwhinnery
kwhinnery / howto.md
Created May 13, 2013
Execute "tishadow run" in your Titanium app directory whenever a JavaScript file changes.
View howto.md

Automatic TiShadow Installs

Execute "tishadow run" in your Titanium app directory whenever a JavaScript file changes. Edit your JS files in a text editor, save, then switch to the test device or simulator. Profit.

Install supervisor

[sudo] npm install -g supervisor

Execute tishadow run anytime a JavaScript file changes

You can’t perform that action at this time.