Skip to content

Instantly share code, notes, and snippets.

View winterlightning's full-sized avatar

Ray Wang winterlightning

View GitHub Profile
@winterlightning
winterlightning / gcalendar.js
Created January 1, 2019 02:18
google calendar script that I wrote to write calendar for accounts
function write_calendar_from_events() {
var firebaseUrl = "https://officeiq-87f37.firebaseio.com/";
var base = FirebaseApp.getDatabaseByUrl(firebaseUrl);
var data = base.getData("/users");
var account = base.getData("/reverse");
//Create a tech's previous events via calendar
Logger.clear()
var all_account = base.getData("/accounts");
var reports = base.getData("/reportsheet");
@winterlightning
winterlightning / gist:1157259
Created August 19, 2011 16:27
Simple db calls to mimic localstorage. Fix for titanium bug
db_path = Titanium.Filesystem.getFile(Titanium.Filesystem.getApplicationDataDirectory(), 'gtasktic.db');
db = Titanium.Database.openFile( db_path );
db.execute("CREATE TABLE IF NOT EXISTS keyval ( key TEXT, value TEXT )");
//Insert
db.execute("INSERT INTO keyval (key, value) VALUES ('" +this.name +"', '"+ result +"')");
//Read
var resultSet = db.execute("SELECT value FROM keyval WHERE key = '"+ this.name +"' LIMIT 1");
result = resultSet.field(0);