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
#!/usr/bin/ruby | |
require 'rss' | |
p 'Downloading rss index' | |
rss_string = open('http://feeds.feedburner.com/railscasts').read | |
rss = RSS::Parser.parse(rss_string, false) | |
videos_urls = rss.items.map { |it| it.enclosure.url }.reverse | |
videos_filenames = videos_urls.map {|url| url.split('/').last } |
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 | |
if ( $app['debug'] ) { | |
$logger = new Doctrine\DBAL\Logging\DebugStack(); | |
$app['db.config']->setSQLLogger($logger); | |
$app->error(function(\Exception $e, $code) use ($app, $logger) { | |
if ( $e instanceof PDOException and count($logger->queries) ) { | |
// We want to log the query as an ERROR for PDO exceptions! | |
$query = array_pop($logger->queries); | |
$app['monolog']->err($query['sql'], array( |
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 | |
//code snippet for causing block to show based on a node's taxonomy term | |
$make_block_visible = FALSE; | |
$term_id_to_trigger_show_block = 19; // replace '19' your term id. | |
if ((arg(0) == 'node') && is_numeric(arg(1))) { | |
$values = array( | |
':nid' => arg(1), | |
':tid' => $term_id_to_trigger_show_block, | |
); |
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 mobile_redirect() { | |
var path = window.location.pathname; | |
if (path != null) { | |
window.location = 'http://host' + path | |
} else { | |
window.location = 'http://host/' | |
} | |
} | |
function setCookie(c_name, value, expiredays) { | |
var exdate = new Date(); |
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
define(["require", "exports"], function (require, exports) { | |
exports.YouTubeHelper = function (settings) { | |
// MEMBERS & DEFAULTS ################################################################################################################################################# | |
var documentRef; | |
var originURL = ""; // for cross site checks | |
var targetContainer; | |
var target; | |
var parentContainer; // used for adding popups back into the original spot |
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
<script id="item-template" type="text/x-jquery-tmpl"> | |
<li><a href="#">${name}</a></li> | |
</script> |
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
/* | |
* Updated to use the function-based method described in http://www.phpied.com/social-button-bffs/ | |
* Better handling of scripts without supplied ids. | |
* | |
* N.B. Be sure to include Google Analytics's _gaq and Facebook's fbAsyncInit prior to this function. | |
*/ | |
(function(doc, script) { | |
var js, | |
fjs = doc.getElementsByTagName(script)[0], |
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
desc "Load production data into development database" | |
task :import_remote_db do | |
filename = "dump.#{Time.now.strftime '%Y-%m-%d_%H:%M:%S'}.sql" | |
dbuser = "yourusername" | |
dbhost = "yourhostname" | |
dbpassword = "yourpassword" | |
application_db = "yourdatabasename" | |
local_db_host = "localhost" | |
local_db_user = "local_user_name" |
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
/* | |
* Updated to use the function-based method described in http://www.phpied.com/social-button-bffs/ | |
* Better handling of scripts without supplied ids. | |
* | |
* N.B. Be sure to include Google Analytics's _gaq and Facebook's fbAsyncInit prior to this function. | |
*/ | |
(function(doc, script) { | |
var js, | |
fjs = doc.getElementsByTagName(script)[0], |
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> | |
<head> | |
<title>index</title> | |
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> | |
<script type="text/javascript"> | |
$(function(){ | |
}); |