Skip to content

Instantly share code, notes, and snippets.

View oroce's full-sized avatar

Róbert Oroszi oroce

  • Budapest, Hungary
View GitHub Profile
@remy
remy / gist:350433
Created March 31, 2010 14:58
Storage polyfill
if (typeof window.localStorage == 'undefined' || typeof window.sessionStorage == 'undefined') (function () {
var Storage = function (type) {
function createCookie(name, value, days) {
var date, expires;
if (days) {
date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
expires = "; expires="+date.toGMTString();
@paulirish
paulirish / utmstrip.user.js
Last active April 11, 2024 07:53
userscript: Drop the UTM params from a URL when the page loads
// ==UserScript==
// @name UTM param stripper
// @author Paul Irish
// @namespace http://github.com/paulirish
// @version 1.2
// @description Drop the UTM params from a URL when the page loads.
// @extra Cuz you know they're all ugly n shit.
// @include http*://*
// ==/UserScript==
@bgerrissen
bgerrissen / gist:713430
Created November 24, 2010 10:06
Require JS Path Expressions

Concept Path Expressions
see https://github.com/bgerrissen/modulejs for partial implementation.

Based on plugin system from RequireJS.

rules

  • Expressions are always placed behind the path.
  • Whitespace can be applied liberally.
  • Params are optional and parenthesis can be omitted.
@x1024
x1024 / gist:794143
Created January 24, 2011 22:46
NodeJS Socket.IO logic test
var http = require('http'),
should = require('should'),
io = require('socket.io'),
decode = require('.npm/socket.io/0.6.8/package/lib/socket.io/utils').decode,
encode = require('.npm/socket.io/0.6.8/package/lib/socket.io/utils').encode,
WebSocket = require('.npm/socket.io/0.6.8/package/support/node-websocket-client/lib/websocket.js').WebSocket;
exports['Socket.IO mocking'] = function(assert){
var _server = require('http').createServer(function(){});
// A mock client object.
@mindplay-dk
mindplay-dk / jquery.scrollbarWidth.js
Created January 26, 2011 15:31
Small plugin that reports the size of the browser's scrollbars in pixels.
/*!
* jQuery Scrollbar Width v1.0
*
* Copyright 2011, Rasmus Schultz
* Licensed under LGPL v3.0
* http://www.gnu.org/licenses/lgpl-3.0.txt
*/
(function($){
@dawsontoth
dawsontoth / InfiniteScrollingTableView.js
Created February 3, 2011 22:49
Infinite loading table view for iOS and Android.
/**
* We're going to create an infinite loading table view. Whenever you get close to the bottom, we'll load more rows.
*/
var win = Ti.UI.createWindow({ backgroundColor: '#fff' });
var isAndroid = Ti.Platform.osname === 'android';
/**
* Create our UI elements.
*/
var table = Ti.UI.createTableView({ top: 0, right: 0, bottom: 0, left: 0 });
@io41
io41 / paginated_collection.js
Created February 22, 2011 10:10 — forked from zerowidth/paginated_collection.js
Pagination with Backbone.js
// includes bindings for fetching/fetched
var PaginatedCollection = Backbone.Collection.extend({
initialize: function() {
_.bindAll(this, 'parse', 'url', 'pageInfo', 'nextPage', 'previousPage');
typeof(options) != 'undefined' || (options = {});
this.page = 1;
typeof(this.perPage) != 'undefined' || (this.perPage = 10);
},
fetch: function(options) {
@dawsontoth
dawsontoth / app.js
Created February 23, 2011 20:08
Swipe for Android plus Vertical Swipes in @appcelerator #titanium
var win = Ti.UI.createWindow({ backgroundColor: '#fff' });
/**
* Adds "swipe" event support to Android, and adds swipe up and down to iOS.
* @param view The view that should be made swipeable.
* @param allowVertical Whether or not vertical swipes (up and down) are allowed; default is false.
* @param tolerance How much further you need to go in a particular direction before swipe is fired; default is 2.
*/
function makeSwipeable(view, allowVertical, tolerance) {
tolerance = tolerance || 2;
@joemaffia
joemaffia / app.js
Created March 24, 2011 18:16
foursquare OAuth in Titanium
/**
*
*
* Copyright 2011 Aaron K. Saunders, Clearly Innovative Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>
@xbb
xbb / gscrape.js
Created April 2, 2011 15:06
simple google scraper test with phantomjs
var Gscrape = function(domain) {
var domain = domain || 'com',
searchURL = 'http://www.google.' + domain + '/search?q=',
searchInProgress = false,
cache = {
error: '',
success: true,
pages: 0,
urls: {}
};