This file contains hidden or 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
var myJSON = { | |
foo : 'bar', | |
lorem : 'ipsum', | |
bar : 'foo', | |
ipsum : 'lorem' | |
} | |
// commas first | |
var myJSON = { | |
foo : 'bar' |
This file contains hidden or 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
javascript:var%20links=document.getElementsByTagName('head')[0].getElementsByTagName('link');for(var%20i=0;i%3Clinks.length;i++){if(links[i].getAttribute('rel')=='apple-touch-icon'){links[i].parentNode.removeChild(links[i])}; break;};var%20s=document.createElement('link');s.setAttribute('rel', 'apple-touch-icon');s.setAttribute('href',prompt('Touch icon URL?','http://'));document.getElementsByTagName('head')%5B0%5D.appendChild(s);void(s); |
This file contains hidden or 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
javascript:(function()%7Bvar%20d%3Ddocument%2Cs%2Ce%3Bvar%20el%3Dd.getElementById('snpy')%3Bif(typeof%20Snoopy!%3D'undefined')%7BSnoopy.toggle()%3Breturn%7Delse%20if(el)%7Bel.className%3D%2Fclosed%2F.test(el.className)%3Fel.className.replace('closed'%2C'')%3Ael.className%2B'%20closed'%3Breturn%7Ds%3Dd.createElement('link')%3Bs.setAttribute('href'%2C'http%3A%2F%2Fsnoopy-assets.allmarkedup.com%2Fsnoopy-min.css')%3Bs.setAttribute('rel'%2C'stylesheet')%3Bs.setAttribute('type'%2C'text%2Fcss')%3Bd.getElementsByTagName('head')%5B0%5D.appendChild(s)%3Be%3Dd.createElement('script')%3Be.setAttribute('src'%2C'http%3A%2F%2Fsnoopy-assets.allmarkedup.com%2Fsnoopy-min.js')%3Bd.getElementsByTagName('body')%5B0%5D.appendChild(e)%7D)()%3B |
This file contains hidden or 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
var player = 'your gamertag'; | |
$.getJSON("http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20html%20where%20url%3D%22http%3A%2F%2Fwww.bungie.net%2FStats%2FReach%2FCareerStats%2Fdefault.aspx%3Fplayer%3D"+player+"%22%20and%20xpath%3D'%2F%2Fspan%5B%40id%3D%22ctl00_mainContent_kdLabel%22%5D'&format=json&diagnostics=true&callback=?", function(data){ | |
var kdr = data.query.results.span.content; | |
alert('My Halo Reach Kill/Death ration is:' + kdr); | |
}); |
This file contains hidden or 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
<? | |
// get a quote for digest email signature... o_O | |
$ch = curl_init('http://iheartquotes.com/api/v1/random?source=art&max_lines=2'); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
$output = curl_exec($ch); | |
curl_close($ch); | |
list($quote) = explode('[', $output); | |
// yeah, that just happened... | |
?> |
This file contains hidden or 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
function incrementPage(parentURL, pageHTML) { | |
var parentPage = SitesApp.getPageByUrl(parentURL) | |
,childPages = parentPage.getAllDescendants() | |
,biggest = 1000; | |
for(i=0; i<childPages.length; i++) { | |
var currentName = childPages[i].getName(); | |
if(isNaN(currentName)) | |
continue; | |
+currentName; // make it a number |
This file contains hidden or 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
<? | |
$host = 'http://api.untappd.com/v1/user_feed/tbeseda?api_key=1234'; | |
$process = curl_init($host); | |
curl_setopt($process, CURLOPT_USERPWD, 'user:pass'); | |
curl_setopt($process, CURLOPT_RETURNTRANSFER, TRUE); | |
$return = curl_exec($process); | |
print_r($return); | |
?> |
This file contains hidden or 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
function fit(str, nMaxChars) { | |
var n = nMaxChars - 1, | |
strRX = /\s|\.|,/, | |
tmp_str = str.slice(0, n), | |
final_str; | |
if (str.length <= n) return str; | |
function getLastChar(str) { | |
return str.slice(str.length-1, str.length); |
This file contains hidden or 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
function bgStripe() { | |
if (!!!document.createElement('canvas').getContext) | |
return; | |
var canvas = document.createElement("canvas"); | |
canvas.width = 6; | |
canvas.height = 1; | |
var ctx = canvas.getContext("2d"); | |
ctx.fillStyle = 'black'; | |
ctx.fillRect(0,0,2,1); | |
ctx.fillStyle = 'rgba(30,30,30,1)'; |
This file contains hidden or 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 you're building the JSON provider with Rails, | |
# add to the as_json method of TimeWtihZone by adding | |
# this file to your config/initializers/ | |
class ActiveSupport::TimeWithZone | |
def as_json(options = {}) | |
strftime('%Y/%m/%d %H:%M:%S %z') | |
end | |
end |
OlderNewer