Skip to content

Instantly share code, notes, and snippets.

View triptych's full-sized avatar
💭
Making web things

Andrew Wooldridge triptych

💭
Making web things
View GitHub Profile
var url = "https://"+un+":"+pw+"@twitter.com/statuses/update.json";
var xhr = Titanium.Network.createHTTPClient();
xhr.onload = function() {
// Handle response
};
xhr.open("POST",url);
xhr.send({ status:'My awesome tweet!' });
Y.use('dd-drag', function(Y) {
var dd = new Y.DD.Drag({
node: '#foo'
});
});
<script type="text/javascript"
src="http://yui.yahooapis.com/3.2.0/build/simpleyui/simpleyui-min.js"></script>
/**
* Sanitize URL — Validate it looks like a URL, then make it less dirty.
*
* Oddnut Software
* Copyright (c) 2010 Eric Ferraiuolo - http://eric.ferraiuolo.name
* MIT License - http://www.opensource.org/licenses/mit-license.php
*
* Examples:
*
* 'Http://WWW.example.com/' » 'http://www.example.com/'
@triptych
triptych / no.de.sh
Created September 27, 2010 06:53 — forked from isaacs/no.de.sh
#!/bin/bash
SERVER=https://api.no.de
SCRIPT="$0"
if [ ${SCRIPT:0:1} == "/" ]; then
SCRIPT="$(basename -- "$SCRIPT")"
fi
main () {
cmd=${1-help}
@triptych
triptych / gist:601750
Created September 28, 2010 20:50 — forked from apipkin/gist:601749
/*** CAREERS ***/
var resumeSubmitBtn = Y.one('#job-submit-resume'),
friendSubmitBtn = Y.one('#job-send-to-a-friend');
resumeSubmitBtn.on('click', function(e){
// get xhr response text
Y.io('/xhr/submit-resume.php?title=' + Y.one('#job_title').get('value') + '&job_subject=' + Y.one('#job_subject').get('value'), {
on : {
success : function(id, o, args) {
@triptych
triptych / gist:605260
Created September 30, 2010 20:28 — forked from apipkin/gist:605147
<!DOCTYPE html>
<html>
<head>
<script src="http://yui.yahooapis.com/3.2.0/build/yui/yui-min.js"></script>
<style> .red { color: red; } </style>
</head>
<body>
<div id="myDiv">Happy</div>
<script>
/*
* An example of
* 1. Using the YUI 3 module system to encapsulate a custom class for reuse
* 2. Creating a Plugin class
* 3. Using Y.Base.create to generate the class
*/
// YUI.add(
// "dash-separated-module-name",
// function (Y) { Y.MyModule = ...; },
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
</head>
<body>
<span id="login"></span>
<script type="text/javascript" src="http://yui.yahooapis.com/3.2.0pr2/build/yui/yui-min.js"></script>
//<iframe id="frame">
var frame = Y.Node.getDOMNode(Y.one('#frame'));
YUI({
win: frame.contentWindow,
doc: frame.contentWindow.document
}).use('node', function(Frame) {
//An element inside the frame
var foo = Frame.one('#foo');
});