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 request.xhr? | |
# renders :template_partial without layout.html | |
erb :template_partial, :layout => false | |
else | |
# renders as normal inside layout.html | |
erb :template_partial | |
end |
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
# 1. Add GPG Key | |
$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10 | |
# 2. Open source.list | |
# Add 10gen as source to end of file: deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen | |
# update Aptitude sources | |
$ vim /etc/apt/source.list | |
$ sudo apt-get update |
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
<?php | |
$clients = 'Whoop!'; | |
$stats = 'Poop!'; | |
if ( $clients || $stats ) { | |
echo '<h2 class="title"><span>The Results</span></h2>'; | |
if ( $clients ) echo '<div class="clients left">' .$clients. '</div>'; | |
if ( $stats ) echo '<div class="stats left">' .$stats. '</div>'; | |
} else { | |
echo '<!-- no content -->'; |
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 getImages(setID) { | |
$.getJSON("http://api.flickr.com/services/rest/?method=flickr.photosets.getPhotos&api_key=yourKeyhere8&photoset_id=" + setID + "&lang=en-us&format=json&jsoncallback=?", displayImages); | |
} | |
function displayImages(data) { | |
var htmlString = ""; | |
$.each(data.photoset.photo, function(i,photo){ | |
var imgSrc = 'http://farm' + photo.farm + '.static.flickr.com/' + photo.server + '/' + photo.id + '_' + photo.secret + '_b.jpg'; | |
htmlString += '<img title="' + photo.title + '" src="' + imgSrc; |
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
def download_file(url) | |
request = "GET #{url} HTTP/1.0\r\n\r\n" | |
host = /^https?:\/\/([^\/]+)/.match(url.to_s) | |
socket = TCPSocket.open(host[1].to_s,80) | |
socket.print(request) | |
# find beginning of response body | |
buffer = "" | |
while !buffer.match("\r\n\r\n") do |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Cross-browser kerning-pairs & ligatures</title> | |
<style> | |
body { font-family: sans-serif; background: rgba(30, 10, 0, 0.05); color: rgba(40, 30, 0, 1); width: 500px; margin: 80px auto; padding: 0px; } | |
a { color: rgba(15, 10, 0, 0.8); text-decoration: none; border-bottom: 1px solid; padding: 1px; -webkit-transition: background 1s ease; } | |
a:hover { background: rgba(0, 220, 220, 0.2); } | |
p { line-height: 1.5; padding: 0px 1em 0em 0em; } |
NewerOlder