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
You must download the yui3-files (for every version you want to serve) as well as the Gallery-modules.
Yui3 --> http://yuilibrary.com/yui/quick-start/ or https://github.com/yui/yui3
Gallery --> download zip from https://github.com/yui/yui3-gallery
The Gist presumes the next directory-structure on the server:
/usr/local/yui_libraries/
/usr/local/yui_libraries/yui3/
/usr/local/yui_libraries/yui3/3.10.3/...
<html>
<head>
<title>Wordnik demo from JavaScript</title>
<script src="http://static.smallpicture.com/bootstrap/js/jquery-1.9.1.min.js"></script>
<script>
var baseUrl = "http://api.wordnik.com/v4/word.json/";
var apiKey = "a2a73e7b926c924fad7001ca3111acd55af2ffabf50eb4ae5"; //demo key from developer.wordnik.com
function getSynonyms (theWord, callback) {
var url = baseUrl + theWord + "/relatedWords?useCanonical=true&relationshipTypes=synonym&limitPerRelationshipType=100&api_key=" + apiKey;
var jxhr = $.ajax ({
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!' });
<script type="text/javascript"
src="http://yui.yahooapis.com/3.2.0/build/simpleyui/simpleyui-min.js"></script>
Y.use('dd-drag', function(Y) {
var dd = new Y.DD.Drag({
node: '#foo'
});
});
/**
* 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 = ...; },