Skip to content

Instantly share code, notes, and snippets.

@Arood
Arood / commit
Created May 8, 2017
git status/add/commit in one command
View commit
#!/bin/bash
status=$(git -c color.status=always status -s)
if [ "$status" == "" ]; then
printf "Nothing to commit\n"
exit 1
fi
printf "%s\n\nEnter your commit message, or cancel with Ctrl+C:\n" "$status"
@Arood
Arood / gist:e418a5548c72f82538a9
Created Aug 29, 2014
Takes screenshots of a UI control in Titanium and all its parents
View gist:e418a5548c72f82538a9
var Loopy = function(control, list) {
if (!control || control.apiName.substr(0,5) !== "Ti.UI") {
var html = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, "layers.html");
var markup = '<html><head></head><body>';
var toWrap = '';
list.forEach(function(item) {
@Arood
Arood / gist:92046dca9434ef798cfe
Last active Aug 29, 2015
Send form data to Jira issue as comment
View gist:92046dca9434ef798cfe
<?php
$username = 'xxx';
$password = 'xxx';
$host = 'http://xxx';
$issue = 'KEY-000';
if (count($_POST) > 0) {
$body = "";
@Arood
Arood / server.js
Created Nov 21, 2013
Quick web server for static files
View server.js
var fs = require('fs'),
http = require('http');
http.createServer(function (req, res) {
fs.readFile(__dirname + "/." + req.url.split("?")[0], function (err,data) {
if (err) {
res.writeHead(404);
res.end(JSON.stringify(err));
return;
}
@Arood
Arood / animate.js
Created May 25, 2013
A wrapper for http://billdawson.github.io/ti-android-animation/, to make the API more like the regular Ti.UI.Animation
View animate.js
/**
* A wrapper for http://billdawson.github.io/ti-android-animation/,
* to make the API more like the regular Ti.UI.Animation
*
* Notes:
* - I haven't added a wrapper for "curving" yet
* - Added "scale", "translateX" and "translateY" as separate properties that can be used instead of "transform" on iOS
* - You can only set "top" and "left" on Android, "right" or "bottom" doesn't work (since the position is animated in X or Y)
* - AnchorPoint doesn't seem to work on Android
*
@Arood
Arood / deploy
Created Apr 21, 2013
Almost like my watch-script, but will only run once, and will minify the code as well.
View deploy
#!/bin/sh
JS_PATH="_js"
FINAL_JS="scripts.js"
SASS_PATH="_sass"
FINAL_CSS="."
echo " ≫ Building and minifying assets."
@Arood
Arood / watch
Created Apr 21, 2013
Watches for changes in JavaScript and Sass-folders
View watch
#!/bin/sh
JS_PATH="_js"
FINAL_JS="scripts.js"
SASS_PATH="_sass"
FINAL_CSS="."
sha=0
previous_sha=0
@Arood
Arood / images2android.sh
Created Oct 10, 2012
Convert iPhone-resources to Android (for Titanium)
View images2android.sh
type mogrify >/dev/null 2>&1 || { echo >&2 "» This script requires mogrify. Please install ImageMagick first!"; exit 1; }
rm -rf Resources/android/images
mkdir Resources/android/images
mkdir Resources/android/images/res-xhdpi
mkdir Resources/android/images/res-mdpi
echo " » Copying the splash screen"
cp Resources/iphone/Default.png Resources/android/images/res-mdpi/default.png
cp Resources/iphone/Default@2x.png Resources/android/images/res-xhdpi/default.png
@Arood
Arood / gist:2113129
Created Mar 19, 2012
Validate a URI
View gist:2113129
# Modified https://gist.github.com/9281 to validate a remote URI instead.
# Wouldn't surprise me if a better CLI-tool is already available, but hey,
# we might improve it later. Also: Pretty colors!
task :validate, :site_uri do | t, args|
require 'net/http'
require 'w3c_validators'
include W3CValidators
You can’t perform that action at this time.