Skip to content

Instantly share code, notes, and snippets.

@myleftboot
myleftboot / sql needs decode
Created May 11, 2012 22:20
SQL code in need of a decode. Try to do as much computation within the sql as is reasonably possible.
FUNCTION get_printed_status
RETURN varchar2 IS
v_order status orders.printed%TYPE;
v_status varchar2(30);
BEGIN
SELECT printed
INTO v_order_status
FROM orders
WHERE order_no = p_order_no;
@myleftboot
myleftboot / cleaner code with a decode
Created May 11, 2012 22:23
Move your logic into the sql statement, clean up your code....
FUNCTION get_printed_status
RETURN varchar2 IS
v_order status orders.printed%TYPE;
v_status varchar2(30);
BEGIN
SELECT decode(printed, null, 'NOT PRINTED'
, 0, 'NOT PRINTED'
@myleftboot
myleftboot / gist:3504693
Created August 28, 2012 21:56
sweeTweet exmaple tweet call
var test = require('tmm.tweet');
test.tweet({ message: label.value, /* the message to tweet */
account: defAcct, /* the Twitter account to send the tweet from, can be left blank */
urls: ['copeconsultancy.co.uk/apps'], /* a url to attach to the tweet, optonal */
image: piccy, /* a Ti.blob image to attach to the tweet, optional */
success: function(obj) { alert('Tweet successfully sent'); Ti.API.info('Status Code = '+obj.result); },
cancel: function(obj) { alert('User has cancelled tweet'); },
error: function(obj) { alert('Unable to send tweet'); Ti.API.info('Status Code = '+obj.result); },
noAccount: function(obj) { alert('User has no twitter accounts on the device'); },
@myleftboot
myleftboot / emp->dept.sql
Created September 13, 2012 15:35
Standard emp to dept select
DECLARE
l_row dept%ROWTYPE;
BEGIN
BEGIN
SELECT d.*
INTO l_row
FROM dept d
WHERE dname = 'Accounts';
EXCEPTION
WHEN no_data_found THEN
@myleftboot
myleftboot / Code_generated_lookup.sql
Created September 13, 2012 15:38
How a empt to dept lookup looks after a code generator
DECLARE
l_row dept%ROWTYPE;
BEGIN
l_row := dept_api.get(p_dname => 'Accounts');
/* Do something with the value you have retrieved in l_row */
END;
@myleftboot
myleftboot / urbanairship.js
Created January 2, 2013 22:36
UrbanAirship module for Titanium
/* Created by Darren Cope, Cope Consultancy Services
UrbanAirship javascript registration API for iOS
*/
var baseurl = 'https://go.urbanairship.com';
/* Mandatory parameters for this call
* _args.token : the device token returned from APNS
* _args.key : the Application key as registered with UrbanAirship
* _args.secret : The Application secret as registered with UrbanAirship
@myleftboot
myleftboot / analytics.js
Created January 3, 2013 07:22
Google Analytics interface for Titanium. Events are uuencoded so spaces are not a problem
/*
The MIT License
Copyright (c) 2010 Roger Chapman
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@myleftboot
myleftboot / social.js
Created March 5, 2013 20:17
An implementation of social.js for Appcelerator Titanium. Works with Twitter v1.1 effective from 5th March 2013
/**
* This is a JavaScript module for Titanium Mobile made by Dawson Toth. I adapted the majority of this code from other
* authors to make it easy to share content on social sites through a single interface.
*
* Example usage: http://appc.me/social.sample.js
*
*/
//