Skip to content

Instantly share code, notes, and snippets.

View qborreda's full-sized avatar

Quique Borredá qborreda

View GitHub Profile
// Based on fantastic jQuery useragent parser plugin https://gist.github.com/373298
function parse(uaStr) {
var agent = {
platform: {},
browser: {},
engine: {}
};
var ua = uaStr,
p = agent.platform,
env = (function() {
var flags = {}, ua = navigator.userAgent, el = document.createElement('div'), video = document.createElement('video'), audio = document.createElement('audio'), root = document.documentElement, i
function flag(names) {
names = names.split(' ')
for (i = 0; i < names.length; i++)
flags[names[i]] = true
}
function classnames() {
var names = [], name
for(name in flags) if (flags.hasOwnProperty(name))
@qborreda
qborreda / no.control.js
Last active August 29, 2015 14:04
Various javaScript methods to prevent user control and menus ..
// Disable Context Menu
document.oncontextmenu = function () {
return false
};
// Disable dragging of HTML elements
document.ondragstart = function () {
return false
};
@qborreda
qborreda / twitter-proxy.php
Created June 6, 2013 15:45 — forked from MikeRogers0/twitter-proxy.php
Access Twitter data from a php proxy
<?php
/**
* Usage:
* Send the url you want to access url encoded in the url paramater, for example (This is with JS):
* /twitter-proxy.php?url='+encodeURIComponent('statuses/user_timeline.json?screen_name=MikeRogers0&count=2')
*/
// The tokens, keys and secrets from the app you created at https://dev.twitter.com/apps
$config = array(