Skip to content

Instantly share code, notes, and snippets.

@himalay
himalay / sed-oneliner.sh
Last active December 8, 2021 10:18
Useful One-Line Scripts for sed command.
#USEFUL ONE-LINE SCRIPTS FOR SED (Unix stream editor) Dec. 29, 2005
#Compiled by Eric Pement - pemente[at]northpark[dot]edu version 5.5
#Latest version of this file (in English) is usually at:
# http://sed.sourceforge.net/sed1line.txt
# http://www.pement.org/sed/sed1line.txt
#This file will also available in other languages:
# Chinese - http://sed.sourceforge.net/sed1line_zh-CN.html
# Czech - http://sed.sourceforge.net/sed1line_cz.html
@himalay
himalay / awk-oneliner.sh
Created March 4, 2014 18:45
Useful One-Line Scripts for awk command.
#HANDY ONE-LINE SCRIPTS FOR AWK 30 April 2008
#Compiled by Eric Pement - eric [at] pement.org version 0.27
#Latest version of this file (in English) is usually at:
# http://www.pement.org/awk/awk1line.txt
#This file will also be available in other languages:
# Chinese - http://ximix.org/translation/awk1line_zh-CN.txt
#USAGE:
@himalay
himalay / sources.list
Created March 7, 2014 13:51
Crunchbang Linux Sources
####################
#### CRUNCHBANG ####
####################
## Compatible with Debian Wheezy, but use at your own risk.
deb http://packages.crunchbang.org/waldorf waldorf main
deb-src http://packages.crunchbang.org/waldorf waldorf main
####################
#######################
@himalay
himalay / app.js
Last active August 29, 2015 14:17 — forked from FokkeZB/app.js
http://developer.android.com/guide/topics/resources/providing-resources.html#ScreenAspectQualifier
if ((Ti.Platform.displayCaps.platformWidth / Ti.Platform.displayCaps.platformHeight) < (((Ti.Gesture.orientation === Ti.UI.LANDSCAPE_LEFT)) ? (320 / 240) : (240 / 320)))) {
Ti.API.info('I am LONG');
} else {
Ti.API.info('I am NOTLONG');
}
@himalay
himalay / index.xml
Last active August 29, 2015 14:17 — forked from FokkeZB/index.xml
Need a Window on IOS but a View on Android in Alloy?
<Alloy>
<Window module="xp.ui">
<Label>Hello World</Label>
</Window>
</Alloy>
@himalay
himalay / app.tss
Last active August 29, 2015 14:17 — forked from FokkeZB/app.tss
Hide titlebar on Android launch/splash screen
// app/styles/app.tss
"Window": {
navBarHidden: false
}
@himalay
himalay / share.js
Last active August 29, 2015 14:17 — forked from FokkeZB/share.js
A simple example of using Android intents to share texts, URLs and files like you could do using 0x82's ShareKit module (https://marketplace.appcelerator.com/apps/741) or any other similar module (TiSocial: https://github.com/viezel/TiSocial.Framework) for iOS
function share(options) {
if (OS_ANDROID) {
var intent = Ti.Android.createIntent({
action: Ti.Android.ACTION_SEND
});
intent.putExtra(Ti.Android.EXTRA_SUBJECT, options.title);
@himalay
himalay / index.tss
Last active August 29, 2015 14:17 — forked from FokkeZB/index.tss
Who said you can't do padding in Titanium (Alloy)?
"#wrapper": {
// Set wrapper to adjust it's size to it's contents
width: Ti.UI.SIZE,
height: Ti.UI.SIZE,
// Set stuff like borders and backgrounds on the wrapper
backgroundColor: "red"
}
@himalay
himalay / app.js
Last active August 29, 2015 14:17 — forked from FokkeZB/app.js
Code Revisions 2 Stars 8 Forks 1 Embed URL HTTPS clone URL You can clone with HTTPS or SSH. Embedding a YouTube video in Titanium
var win = Ti.UI.createWindow();
var webView = Ti.UI.createWebView({
url: 'http://www.youtube.com/embed/' + myVideoID + '?autoplay=1&autohide=1&cc_load_policy=0&color=white&controls=0&fs=0&iv_load_policy=3&modestbranding=1&rel=0&showinfo=0',
enableZoomControls: false,
scalesPageToFit: false,
scrollsToTop: false,
showScrollbars: false
});
@himalay
himalay / singletap.js
Last active August 29, 2015 14:17 — forked from FokkeZB/singletap.js
Snippet from Blain Hamon on how to prevent Titanium from queing up multiple tap events
function handleOnce(funct) {
var flag = false;
return function(e) {
if (flag) return;
flag = true;
setTimeout(function() {
flag = false;
}, 0);
funct(e);