Skip to content

Instantly share code, notes, and snippets.

View jakearchibald's full-sized avatar
💭
Tired

Jake Archibald jakearchibald

💭
Tired
View GitHub Profile
function slideRight(elm, seconds, opts) {
elm = glow.dom.get(elm);
opts = opts || {};
// make the tween easeBoth by default
opts.tween = opts.tween || glow.tweens.easeBoth();
// get the full width of the item
var currentWidth = elm[0].style.width,
fullWidth,
anim;
function getFilterOpts(type, item, callback) {
var requestUrl = "/api/plugin:"+type+"/config?path=" +item;
var str = '';
// get json data from config
glow.net.get(requestUrl, {
onLoad: function(response) {
var data = response.json();
str += '<p>'+data.a_value+'</p>';
// simplified example of what I need to add to var str.
var listenerRef;
function addListener() {
listenerRef = glow.events.addListener(myCarousel2, 'afterScroll', afterScrollListener);
}
fucntion removeListener() {
glow.events.removeListener(listenerRef);
}
function toggleOnClick(elmToToggle, elmToClick) {
elmToToggle = glow.dom.get(elmToToggle);
var fullHeight = elmToToggle.height();
glow.events.addListener(elmToClick, 'click', function() {
if (elmToToggle.height()) {
glow.anim.slideUp(elmToToggle, 1);
} else {
glow.anim.css(elmToToggle, 1, {
function User(name,id) {
this.name = name;
this.id = id;
}
User.prototype.show_user = function() {
alert("Nom : " + this.name + " id : " + this.id);
}
var test_object = new User("greg",2);
Function.prototype.delay = function(ms, obj) {
setTimeout(function() {
this.call(obj);
}, ms)
}
function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}
new glow.widgets.Timetable(container, startTime, endTime, viewStartTime, viewEndTime, {
// timetable options
tracks: [
// add an array for each track like this...
[trackTitle, trackSize, {
// track options
items: [
// add an array like this for each item
[title, startTime, endTime, opts]
]
<script type="text/javascript">
(function() {
var glow;
gloader.load(
["glow", "1", "glow.widgets.Panel"],
{
async: true,
onLoad: function(g) {
glow = g;
return (
a[2] < b[0] ? 0 :
b[2] < a[0] ? 0 :
a[0] < b[0] ? (a[2] < b[2] ? a[2] - b[0] : b[2] - b[0]) :
b[2] < a[2] ? b[2] - a[0] : a[2] - a[0]
) * (
a[1] < b[3] ? 0 :
b[1] < a[3] ? 0 :
a[3] < b[3] ? (a[1] < b[1] ? a[1] - b[3] : b[1] - b[3]) :
b[1] < a[1] ? b[1] - a[3] : a[1] - a[3]