This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{# app/Resources/TwigBundle/views/Exception/error.html.twig #} | |
{% extends '::layout.html.twig' %} | |
{% block title %} | |
Erro {{ status_code }} | |
{% endblock %} | |
{% block content %} | |
{% if status_code == '404' %} | |
<h1>Página não encontrada</h1> | |
{% else %} | |
<h1>Erro inesperado</h1> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Workers: Compatibility</title> | |
<script> | |
// This script is executed in the main window | |
/* | |
we'll use a worker to filter a huge data set |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (!window.localStorage || !window.sessionStorage) (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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (!navigator.geolocation) { | |
navigator.geolocation = (function (window, document) { | |
function getCurrentPosition(callback) { | |
var geourl = 'http://www.google.com/jsapi?' + Math.random(), | |
iframe = document.createElement('iframe'), | |
doc, win; | |
iframe.style.display = 'none'; | |
window.document.body.appendChild(iframe); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* twitter-entities.js | |
* This function converts a tweet with "entity" metadata | |
* from plain text to linkified HTML. | |
* | |
* See the documentation here: http://dev.twitter.com/pages/tweet_entities | |
* Basically, add ?include_entities=true to your timeline call | |
* | |
* Copyright 2010, Wade Simmons | |
* Licensed under the MIT license |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
## Parse query string. | |
$sb_league = $_GET['league'] ? strtolower( $_GET['league'] ) : 'all'; | |
## Nav data, as a JSON heredoc. Much less verbose than PHP arrays! | |
$navs = json_decode(<<<JSON | |
{ | |
"mlb": { | |
"title_link": "http://stats.boston.com/mlb/scoreboard.asp", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
function doLogin(doneUrl) { | |
/* Tell XAuth.org that a user has just signed into Google on this browser. */ | |
XAuth.extend({ | |
// reveals "someone is logged into Google" | |
token: "1", | |
// Expires after 24 hours or if the user explicitly logs out | |
expire: new Date().getTime() + 60*60*24*1000, | |
// Allow any domain to read this info (could also be a whitelist of partners) | |
extend: ["*"], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Google XAuth Demo</title> | |
<script type="text/javascript" src="http://xauth.org/xauth.js"></script> | |
<script type="text/javascript"> | |
function doLogin(doneUrl) { | |
/* Tell XAuth.org that a user has just signed into Google on this browser. */ | |
XAuth.extend({ | |
// Just reveals "someone is logged into Google" but no personally identifiable info. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Get the TwitterOAuth source code: | |
* http://github.com/abraham/twitteroauth | |
* git clone git@github.com:abraham/twitteroauth.git | |
* | |
* Get your OAuth credentials: | |
* http://dev.twitter.com/pages/oauth_single_token | |
*/ |
NewerOlder