Skip to content

Instantly share code, notes, and snippets.

@clathrop
clathrop / camera-overlay
Created July 26, 2012 18:49
Titanium: Using a camera overlay and saving images to internal storage
var win = Titanium.UI.createWindow();
var scanner = Titanium.UI.createView({
width : 260,
height : 200,
borderColor : 'red',
borderWidth : 5,
borderRadius : 15
});
@mdkarp
mdkarp / gist:4015387
Created November 5, 2012 04:46 — forked from zhendershot/gist:3607211
REST API Upload to S3 in Titanium
function upload(name, file, callback) {
Ti.include('lib/sha-aws.js'); // file comes from this URL's project: http://aws.amazon.com/code/Amazon-S3/3236824658053653
Ti.include('lib/webtoolkit.utf8.js'); // code for this file from this URL: http://www.webtoolkit.info/javascript-utf8.html
Ti.include('lib/date.js'); // file comes from this URL: http://www.mattkruse.com/javascript/date/source.html
var AWSAccessKeyID = appGlobal.config.s3AccessKey;
var AWSSecretAccessKey = appGlobal.config.s3SecretKey;
var AWSBucketName = appGlobal.config.s3BucketName;
var AWSHost = appGlobal.config.s3Host;
@markpundsack
markpundsack / heroku-CVE-2013-0156.rb
Last active November 27, 2023 15:44 — forked from elliottkember/heroku-CVE-2013-0156.rb
Forked from https://gist.github.com/4489689 by elliottkember. CVE-2013-0156 is a nasty vulnerability in many versions of Rails. This script checks all your Heroku apps for this vulnerability in one quick (slow) move. More info: https://groups.google.com/forum/#!topic/rubyonrails-security/61bkgvnSGTQ/discussion
## The quick-and-nasty CVE-2013-0156 Heroku inspector!
## Originally brought to you by @elliottkember with changes by @markpundsack @ Heroku
## Download and run using:
## ruby heroku-CVE-2013-0156.rb
`heroku list`.split("\n").each do |app|
app = app.strip
# Some "heroku apps" lines have === formatting for grouping. They're not apps.
next if app[0..2] == "==="
@aaronksaunders
aaronksaunders / tiparse.js
Last active November 14, 2018 18:00
Tested w/ latest version of parse "parse-1.2.7.js"
var TiParse = function(options) {
// need to convert this to requires
Ti.include("parse-1.2.7.js");
Parse.localStorage = {
getItem : function(_key) {
return Ti.App.Properties.getObject(_key);
},
setItem : function(_key, _value) {
@cmchap
cmchap / Raspberry_Pi_Water_Sensor
Last active January 13, 2024 11:24
Raspberry Pi Water Sensor - Incredibly vague schematic here: http://fritzing.org/projects/raspberry-pi-water-sensor/
#!/usr/bin/python
#########
# About #
#########
# This script uses a Raspberry Pi to sense for the presense or absense of water.
# If there is water, an email is sent and a buzzer goes off.
# When it's dry again, another email is sent, and the buzzer turns off.
@julionc
julionc / 00.howto_install_phantomjs.md
Last active April 26, 2024 09:13
How to install PhantomJS on Debian/Ubuntu

How to install PhantomJS on Ubuntu

Version: 1.9.8

Platform: x86_64

First, install or update to the latest system software.

sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev
@rutvij-pandya
rutvij-pandya / echo_sign_api
Created January 30, 2014 07:40
EchoSign API implementation in Ruby on Rails
### Core library for EchoSign APIs
### Use a wrapper file for validations & response handling
### Get a Developer Edition account & replace "YOUR_ACCOUNT_API_KEY" with API key of your account.
### With Rails, use Savon gem for SOAP based requests.
module EchoSignApi
API_URI = 'https://secure.echosign.com/services/EchoSignDocumentService15?wsdl'
API_KEY = YOUR_ACCOUNT_API_KEY
@octocat
octocat / .gitignore
Created February 27, 2014 19:38
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@nocturnalgeek
nocturnalgeek / MailinatorAliases
Last active April 8, 2024 20:45
A list of alternate domains that point to @mailinator.com
@binkmail.com
@bobmail.info
@chammy.info
@devnullmail.com
@letthemeatspam.com
@mailinater.com
@mailinator.net
@mailinator2.com
@notmailinator.com
@reallymymail.com
with table_stats as (
select psut.relname,
psut.n_live_tup,
1.0 * psut.idx_scan / greatest(1, psut.seq_scan + psut.idx_scan) as index_use_ratio
from pg_stat_user_tables psut
order by psut.n_live_tup desc
),
table_io as (
select psiut.relname,
sum(psiut.heap_blks_read) as table_page_read,