Skip to content

Instantly share code, notes, and snippets.

@theamith
theamith / git_cheat-sheet.md
Created April 4, 2018 09:01 — forked from davfre/git_cheat-sheet.md
git commandline cheat-sheet
/**
* Event handler to prevent richtext and linebreaks in contentEditable DIVs
*/
$('body').on('keydown paste', 'div.editfield', function(e) {
var $field = $(e.currentTarget);
if (e.keyCode===13 && $field.hasClass('multiline')) {
return true;
} else if (e.keyCode===13 || e.type==='paste') {
setTimeout(function() {
$field.html($field.text());
@theamith
theamith / app.js
Last active December 21, 2015 04:18 — forked from manumaticx/BackgroundNotification.js
Android background service called from bencoding.AlarmManager BackgroundNotification.js for scheduling daily notification
//Import bencoding alarmmanager module into our Titanium App
var alarmModule = require('bencoding.alarmmanager');
var alarmManager = alarmModule.createAlarmManager();
var isRunning = Ti.App.Properties.getBool("service_running", false);//get service running bool status
if (isRunning) {
Ti.API.info('service is running');
} else {
Ti.API.info('service is not running');
alarmManager.addAlarmService({