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 | |
// EE to WP Export template | |
// Run at http://site.com/template-location/CHANNEL_NAME/POST_TYPE/CONTENT_FIELD_NAME/FEATURED_IMAGE_FIELD_NAME/OFFSET | |
// It's important to use a root level template, and restrict access to the admin role | |
// Set Type to XML, allow PHP, and PHP Parse on Output | |
$DB = &$this->EE->db; | |
echo '<' . '?' . 'xml version="1.0" encoding="UTF-8"' . '?' . '>'; | |
?> | |
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
var a = []; | |
for (var i in localStorage){ | |
if (localStorage.propertyIsEnumerable(i) && i.indexOf('dataset_')===0){ | |
a.push( i.split('_')[1] ); | |
} | |
} | |
$('#container').load([location.path, a.join('|')].join('/')); |
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
// Convert CamelCase to an under_scored_word | |
function underscore(s){ | |
return s.replace(/(?!^)([A-Z])/g, function(m){ return '_' + m }).toLowerCase(); | |
} |
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 | |
static function present($object){ | |
$klass= ucfirst(preg_replace_callback('/_([a-z])/', | |
function($m) { return strtoupper($m[1]);}, | |
$object->type)). 'Presenter'; | |
return new $klass($object); | |
} | |
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
#!/usr/bin/env drush | |
# Once it prints the faulty variable names, just re-set the values using `drush vset {variable_name} "{value}" | |
$variables = db_query('SELECT name, value FROM {variable}')->fetchAllKeyed(); | |
foreach ($variables as $key => $val) { | |
$v = unserialize($val); | |
if ($v === FALSE && $val !== 'b:0;') { |
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
div { font-family: Helvetica, Arial, sans-serif; width: 50%;} | |
ol li { | |
list-style-type: none; | |
counter-increment: li; | |
margin-bottom: 0.5em; | |
margin-left: 3em; | |
} | |
ol li:before { | |
content: counter(li); | |
position: relative; |
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
$.each(document.styleSheets, function() { | |
this.href ? console.log(this.href) : $.map(this.cssRules, function(import){ console.log(import.href) }) | |
}) |
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
# Variation on Hashrocket's script for managing the git process | |
# as documented here: http://reinh.com/blog/2008/08/27/hack-and-and-ship.html | |
# Create shell scripts out of each of these, put them in your path (~/bin for example) | |
# chmod 755 them and use like this: | |
# | |
# This version of hack is totally different than Hackrockets. I feel that hack implies | |
# that you are getting started, not finishing up. sink is Hashrockets hack. | |
# | |
# $ hack branch_name | |
# Test and Implement until done |
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
# Given a number, write a method that outputs the following: | |
# when a multiple of 3, output "appy" | |
# when a multiple of 5, output "fizz" | |
# when a multiple of 3 and 5, output "appy-fizz" | |
# Otherwise, output "I'm all good here." | |
def appyfizz(n) | |
s = [] | |
s << "appy" if n % 3 == 0 | |
s << "fizz" if n % 5 == 0 |
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
$fib = Hash.new { |_,n| n < 2 ? n : $fib[n-1] + $fib[n-2] } | |
def fibsequence(n) | |
(0...n).map{ |i| $fib[i] }.join(',') | |
end | |
100.times do |i| | |
puts [i, fibsequence(i)].join(' - ') | |
end |
NewerOlder