Skip to content

Instantly share code, notes, and snippets.

@mschmulen
mschmulen / uninstall-strongloop-suite.sh
Created January 3, 2014 19:05
uninstall strongloop suite
#!/bin/sh
(( ${#} > 0 )) || {
echo 'The uninstaller is now trying to remove StrongLoop Suite'
echo 'Press Control-C to quit or Enter to continue the script with sudo: '
read
echo 'Re-running the script with sudo.'
echo 'You may be prompted for a password for the sudo command.'
sudo ${0} sudo
exit $?
}
@chengyin
chengyin / linkedout.js
Last active July 11, 2021 15:23
Unsubscribe all LinkedIn email in "one click". For an easier to use version, you can check out the bookmarklet: http://chengyin.github.io/linkedin-unsubscribed/
// 1. Go to page https://www.linkedin.com/settings/email-frequency
// 2. You may need to login
// 3. Open JS console
// ([How to?](http://webmasters.stackexchange.com/questions/8525/how-to-open-the-javascript-console-in-different-browsers))
// 4. Copy the following code in and execute
// 5. No more emails
//
// Bookmarklet version:
// http://chengyin.github.io/linkedin-unsubscribed/
@mschmulen
mschmulen / README.md
Last active December 24, 2015 06:09
Angular Standalone, Disconnected and Mocked inline html and javascript

Simple Angular App Example, Disconnected and Mocked inline html and javascript

simply clone the repo locally and

 git clone https://gist.github.com/6755421.git AngularStandalone
 cd AngularStandalone
 open index.html
@rblalock
rblalock / swipe.js
Last active December 14, 2015 00:59
// Custom swipe detection for table rows (since technically the "swipe"
// event doesn't apply to individual rows but rather the table. This way we
// don't have to assign a swipe event for each row. One event to manage
// them all is more performant.
var TOUCH_X = 0;
$.list.addEventListener("touchstart", function(e) {
TOUCH_X = e.x;
});
$.list.addEventListener("touchend", function(e) {
if(e.x > (TOUCH_X + 44)) {
@sauntimo
sauntimo / ObjectPropertyLoop.js
Created November 9, 2012 19:51
Looping through Object Properties
function OnSubmit(e){
var NewSubmission = {};
var Properties = ["Timestamp","Favourite Colour","Explanation"];
var i = 0;
for(i = 0; i < Properties.length; i++){
NewSubmission[Properties[i]] = e.values[i];
}
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@Mode54
Mode54 / ActionBarView.js
Created July 22, 2012 16:00
Action Bar Module for Titanium Mobile
/*
* Android API Guide
* http://developer.android.com/guide/topics/ui/actionbar.html
* Android Design Guide
* http://developer.android.com/design/patterns/actionbar.html
* Titanium Mobile will support someday
* https://jira.appcelerator.org/browse/TIMOB-2371
*/
var osName = Ti.Platform.osname,
isAndroid = osName==='android',
@stackedsax
stackedsax / android_emu_start.sh
Created May 8, 2012 21:42
Script for starting up multiple android emulators per box
#!/bin/bash
#####
#
# This script creates android emulators on the fly.
#
# Please refer to the README for usage instructions.
#
####
@mschmulen
mschmulen / app.js
Created September 2, 2011 20:44 — forked from dawsontoth/app.js
Rate my app in Appcelerator Titanium Mobile
/**
* The following snippet will ask the user to rate your app the second time they launch it.
* It lets the user rate it now, "Remind Me Later" or never rate the app.
*/
var win = Ti.UI.createWindow({ backgroundColor: '#fff' });
win.addEventListener('open', checkReminderToRate);
win.add(Ti.UI.createLabel({ text: 'This is a simple app that will remind you to rate it.' }));
win.open();
function checkReminderToRate() {
@mhawksey
mhawksey / gist:1170597
Created August 25, 2011 13:02
Google Apps Script to fill in a Document template with Spreadsheet data
function onOpen() {
var menuEntries = [ {name: "Create Diary Doc from Sheet", functionName: "createDocFromSheet"}];
var ss = SpreadsheetApp.getActiveSpreadsheet();
ss.addMenu("Fitness Diaries", menuEntries);
}
function createDocFromSheet(){
var templateid = "1O4afl8SZmMxMFpAiN16VZIddJDaFdeRBbFyBtJvepwM"; // get template file id
var FOLDER_NAME = "Fitness Diaries"; // folder name of where to put completed diaries
// get the data from an individual user