Skip to content

Instantly share code, notes, and snippets.

@bytespider
bytespider / LICENSE.txt
Created November 3, 2011 17:45 — forked from aemkei/LICENSE.txt
hsl2rgb - 140byt.es
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@bytespider
bytespider / gist:1366958
Created November 15, 2011 12:25
Tweet question

Consider two scenarios:

  • compile browser version of a Javascript library, pulling out all require dependencies and putting them in one file.
  • compile a node.js version of the same library, but ignoring those require dependencies allowing node to handle them.

I thought of using requirejs / r.js, however I'm seem to be unable to work out the special sauce to do something like this.

Are there other build systems that can do this? Could I mod r.js in some way? Answers on postcard.

var util = require("util");
exports.show = {
json: function (req, res) {
res.send(JSON.stringify(req.item));
},
default: function (req, res) {
this[req.format](req, res);
}
};
var tabGroup = Ti.UI.createTabGroup();
var tabsArray = tabGroup.tabs;
Object.defineProperty(
tabGroup,
"tabs",
{
get: function () {
alert(tabGroup.tabs.length + " tabs");
@bytespider
bytespider / gist:1579292
Created January 8, 2012 18:48
Titanium rotation bug?
var wnd = Ti.UI.createWindow({
title: "Title Bar",
modal: true,
backgroundColor: "#FFF",
orientationModes: [
Titanium.UI.PORTRAIT,
Titanium.UI.UPSIDE_PORTRAIT,
Titanium.UI.LANDSCAPE_LEFT,
Titanium.UI.LANDSCAPE_RIGHT
],
@bytespider
bytespider / gist:1816040
Created February 13, 2012 10:58 — forked from atsusy/gist:998503
Titanium Mobile sample code(podcast player)
/*
* ユーザーインタフェース
*/
var window = Titanium.UI.createWindow({});
var feedsTable = Titanium.UI.createTableView({});
var playingPanel = Titanium.UI.createView({
bottom:-65,
function clone(object) {
var cloned = Object.create(object.prototype || null);
Object.keys(object).map(function (i) {
cloned[i] = object[i];
});
return cloned;
}
@bytespider
bytespider / gist:2568367
Created May 1, 2012 14:36
Automate updating iDevices
tell application "iTunes"
repeat with s in sources
if (kind of s is iPod) then
tell application "iTunes" to update s
end if
end repeat
end tell
@bytespider
bytespider / menu.sh
Created May 29, 2012 17:44
bash menu
#!/bin/sh
# Author: Rob Griffiths
# Based on work from http://www.unix.com/shell-programming-scripting/27099-drop-down-menu-bash-timezone-select.html
# Licence: MIT
# Copyright (c) 2012 Rob Griffiths
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
[alias]
share = "!URL=`git remote show origin | awk 'NR==2{print $3}' | sed 's/:/\\//;s/git@/http:\\/\\//g;s/\\.git//'`/commit/`git log -1 --format="%H" HEAD` && echo $URL && echo $URL | pbcopy"