Skip to content

Instantly share code, notes, and snippets.

@moxuse
moxuse / gist:4256067
Created December 11, 2012 05:14
Parse cosm.com's XML feed
x = DOMDocument.new;
x.parseXML( "curl --request GET \ --header \"X-ApiKey: APIKEY_HERE\" \ http://api.cosm.com/v2/feeds/FEED_NUM.xml".unixCmdGetStdOut; );
m = x.getElementsByTagName("data");
m.do({arg item;
var child;
v = item.getAttribute("id");
child = item.getChildNodes;
@moxuse
moxuse / gist:4256745
Created December 11, 2012 08:09
Auto sensor value speaker of cosm.com feed 87638 (Circuit Lab Environmental Sensors)
(
t = Task ({
inf.do ({
var dataList, en_subject, jp_subject;
dataList = Array.new;
en_subject = "";
jp_subject = "";
x = DOMDocument.new;
x.parseXML( "curl --request GET \ --header \"X-ApiKey: APIKEY\" \ http://api.cosm.com/v2/feeds/87638.xml".unixCmdGetStdOut; );
on idle theObject
set x to (do shell script "diskutil list")
if "ramdisk" is not in x then
try
do shell script "diskutil erasevolume HFS+ 'ramdisk' `hdiutil attach -nomount ram://8388608`"
end try
end if
return 60
end idle
@moxuse
moxuse / iOS object debug pattern
Created January 25, 2013 03:51
iOS object debug pattern
- (id)init
{
self = [super init];
if (self)
{
NSLog(@"%@: %@", NSStringFromSelector(_cmd), self);
}
return self;
}
- (void)dealloc
p = PlusFreqScopeWindow.new
@moxuse
moxuse / gist:5393551
Last active December 16, 2015 06:39
プロセス監視AppleScript
on idle
tell application "System Events"
set ProcessList to name of every process
if "YOUR_APPNAME" is not in ProcessList then
tell application "YOUR_APPNAME" to launch
end if
end tell
return 30
end idle
@moxuse
moxuse / gist:5440295
Last active December 16, 2015 13:18
QuickTime Player 第二画面フルスクリーン AppleScript
tell application "QuickTime Player"
open file "YOUR FILE"
activate
set the looping of document 1 to true
set the bounds of the first window to {-1920, 0, 0, 1080}
end tell
tell application "System Events"
keystroke "f" using command down
end tell
@moxuse
moxuse / gist:5481055
Created April 29, 2013 11:27
Xcode Indexing
defaults write com.apple.dt.XCode IDEIndexDisable 1
defaults write com.apple.dt.XCode IDEIndexDisable 0
// import UDP library
import hypermedia.net.*;
UDP udp;
void setup() {
udp = new UDP( this, 3054 ); //port from xbee wi-fi
udp.listen( true );
}
this.car_select = $("#swipe-section").children("img");
$('#carSelect').hammer({
prevent_default: true,
drag_vertical: true,
release: true
})
.on('drag dragend', function (ev) {
if (!self.isAnimating) {
var gest = ev.gesture;
switch (ev.type) {