Skip to content

Instantly share code, notes, and snippets.

View joshualambert's full-sized avatar
🎧

Josh Lambert joshualambert

🎧
View GitHub Profile
@m1ga
m1ga / hyperloop.js
Created February 22, 2021 10:35
Appcelerator Titanium - Share data with other apps #appcelerator #titanium #hyperloop
// share items e.g. String with other apps
if (OS_IOS) {
//
// Hyperloop for iOS
//
var UIActivityView = require('UIKit/UIActivityViewController')
var TiApp = require('Titanium/TiApp');
var uiv = UIActivityView.alloc().initWithActivityItemsApplicationActivities(["www.google.com"],null);
TiApp.app().showModalController(uiv, true);
@jpriebe
jpriebe / NestedScrollViewManager.js
Last active August 15, 2021 13:23
Appcelerator Titanium code for managing scrollviews inside of scrollviews
function NestedScrollViewManager (parent_view)
{
// Appcelerator Titanium code for managing scrollviews inside of scrollviews (not true Android
// NestedScrollViews, but just a horizontal scrollview inside of a vertical scrollview).
//
// If you want to put a horizontal scrollview inside a vertical scrollview (like the Netflix app UI),
// it seems to work reasonably well on iOS. But on android, the user experience is very janky.
// Unless the user's drag movements are nearly exactly horizontal, there will be some movement of
// the parent scrollview, and then it becomes very difficult to scroll the child view. Flinging is
// almost impossible.
@ashander
ashander / unfavorite.js
Last active December 7, 2022 01:37
Delete all your favorites (unfavorite or unlike every tweet) on twitter.com (thx to @JamieMason and @b44rd for inspiring this)
// 1. Go to https://twitter.com/i/likes
// 2. Keep scrolling to the bottom repeatedly until all your favs are loaded.
// 3. Run this in your console (open in chrome by View > Developer > JavaScript Console)
// Notes: this may take a while if you have a lot of favs/likes
// you can only access your most recent ~2000 likes.
// inspired by https://gist.github.com/JamieMason/7580315
$('.ProfileTweet-actionButtonUndo').click()
@iotashan
iotashan / alloy.js
Last active March 2, 2017 15:18
Listening for android start/pause/stop/resume events in Titanium
if (OS_ANDROID) {
// Somehow, only in alloy.js we can get the data (URL) that opened the app
Alloy.Globals.url = Ti.Android.currentActivity.intent.data;
Ti.API.info('launch data: '+Ti.Android.currentActivity.intent.data);
Ti.Android.currentActivity.addEventListener('newintent',function(e){
Ti.API.info('newintent ' + JSON.stringify(e.intent.data));
});
Ti.Android.currentActivity.onCreate = function(e){
@runlevel5
runlevel5 / replace_broken_ruby_for_osx_yosemite_developer_release.md
Last active May 8, 2018 12:00
How to replace broken stock Ruby on OSX 10.10 (Build 14A238X) (developer release - 6/6/2014)

The stock version that comes with OS X 10.10 DP1 is know to to suffer following errors:

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/yaml.rb:4:in `<top (required)>':                                                                           
It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- psych (LoadError)
  from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
  from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/yaml.rb:5:in `<top (required)>'
 from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
@mogya
mogya / gist:3781468
Created September 25, 2012 12:24
An idea to convert dp to/from pixel on TitaniumMobile Android
// convert dp to pixel.
function dpToPixel(dp) {
return ( parseInt(dp) * (Titanium.Platform.displayCaps.dpi / 160));
}
// convert pixel to dp.
function pixelToDp(px) {
return ( parseInt(px) / (Titanium.Platform.displayCaps.dpi / 160))+'dp';
}
@joshualambert
joshualambert / datepicker.js
Created July 3, 2012 21:00 — forked from bilalq/datepicker.js
Date Picker in Titanium
var dateOfBirth = Ti.UI.createPicker({
type: Ti.UI.PICKER_TYPE_DATE,
minDate:new Date(1900,1,1),
maxDate:new Date(2000,1,1),
value:new Date(1995,8,1)
});
var birthDayLine = Ti.UI.createView({
layout: 'horizontal',
height: Ti.UI.SIZE,
@RaVbaker
RaVbaker / gist:2967695
Created June 21, 2012 18:44
[HOWTO] Ubuntu 12.04 Ruby on Rails Development Environment

Ubuntu 12.04 Ruby on Rails Development Environment

I haven't set up an install guide for the latest ubuntu release, largely because the last set of instructions worked pretty closely with the latest and greatest Ubuntu, 12.04 Precise Pangolin, however when installing today, I found that there were enough differences in the way that I configure my setup to justify an update, so here it goes. Yes, I'm late to the party, but a quick google search didn't find anything that I felt was as complete for my requirements as my previous install guides, so here I go.

As always with my install guides, I have included here is just about everything you'll need (and then some) to get started with ruby on rails development with Ubuntu 12.04 as a platform. These are my settings and preferences, and this is certainly not the only way of doing things, so keep that in mind.

Step 1: Get the repos ready and run updates.

sudo apt-get update && sudo apt-get upgrade