To make sure your lay-outs look pretty much the same on all devices, including the thousands of different Android resolutions and densities, it's always best to use the 'dp' unit. However, typing '10dp'
instead of 10
is quite a pain. A pain you can easily take away by changing the default unit in your tiapp.xml
.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* /Resources/app.js - Generated by Alloy, here to understand the flow */ | |
var Alloy = require("alloy"), _ = Alloy._, Backbone = Alloy.Backbone; | |
Alloy.createController("index"); |
Often I need to display a user-provided picture in an ImageView in such a way that the whole ImageView is filled with as much of the picture possible.
This is how I do it:
var image = require('image');
Ti.Media.showCamera({
mediaTypes: [Ti.Media.MEDIA_TYPE_PHOTO],
success: function (e) {
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"Window": { | |
backgroundColor: '#fff' | |
}, | |
"Label": { | |
color: '#000', | |
font: { | |
fontWeight: 'bold' | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/bash | |
img=(`find ~/pictures/wallpapers/ -name '*' -exec file {} \; | grep -o -P '^.+: \w+ image' | cut -d':' -f1`) | |
while true | |
do | |
feh --bg-scale "${img[$RANDOM % ${#img[@]} ]}" | |
sleep 30m | |
done |
This is a paragraph, which is text surrounded by whitespace. Paragraphs can be on one
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add this to ~/.bash_profile or ~/.bashrc | |
explain () { | |
if [ "$#" -eq 0 ]; then | |
while read -p "Command: " cmd; do | |
curl -Gs "https://www.mankier.com/api/explain/?cols="$(tput cols) --data-urlencode "q=$cmd" | |
done | |
echo "Bye!" | |
elif [ "$#" -eq 1 ]; then | |
curl -Gs "https://www.mankier.com/api/explain/?cols="$(tput cols) --data-urlencode "q=$1" | |
else |
This is a sample markdown file to help you write Markdown quickly :)
If you use the fabulous [Sublime Text 2/3 editor][ST] along with the [Markdown Preview plugin][MarkdownPreview], open your ST2 Palette with CMD+⇧+P
then choose Markdown Preview in browser
to see the result in your browser.
this is italic and this is bold . another italic and another bold
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style type="text/css"> | |
.tooltip{ | |
display: inline; | |
position: relative; | |
} | |
.tooltip:hover:after{ | |
background: #333; | |
background: rgba(0,0,0,.8); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Twitter Mobile - Enter to send message | |
// @version 0.4 | |
// @description This script allows user to send message by pressing the enter key on Twitter Mobile DM | |
// @author himalay | |
// @namespace https://himalay.com.np | |
// @include *://mobile.twitter.com/messages/* | |
// @run-at document-end | |
// ==/UserScript== |