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
<!-- Add this between the <head></head> tags to influence how Facebook sees your site when someone shares it. --> | |
<meta name="title" content="This is the title of my site." /> | |
<meta name="description" content="This is a description of my site." /> | |
<link rel="image_src" href="http://mysite.com/logo.png" /> |
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 | |
if ( arg(0) == 'node' && is_numeric(arg(1)) ) { | |
$node = node_load(arg(1)); | |
print "node:" . $node->type; | |
} else { | |
print "not a node"; | |
} | |
?> |
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
// Save Form Field Prompts (jQuery) | |
// | |
// If you have form fields with default values like "Enter search term" | |
// this code will save that value, hide it when a user focuses on the field | |
// and restores it when they leave the field if they didn't enter anything. | |
// Select the fields you want to save | |
var $fields = $(".commentform textarea, .commentform input.text"); | |
// No need to change anything below here |
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
// wraps the first character of a paragraph with <div class="dropclass"></div> | |
// expects a jQuery paragraph object | |
// ex: dropCap($('.story p:first')); | |
function dropCap($target) { | |
$first_p = $target.html().trim(); // removes any leading whitespace | |
if ($first_p.charAt(0) != '<') { | |
// not a html tag | |
$target.html( '<div class="dropcap">' + $first_p.charAt(0) + '</div> ' + $first_p.substring(1) ); |
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
<!-- | |
// Add these two meta tags to yourdomain.com. | |
// Now you can use yourdomain.com as your OpenID | |
// and authenticate using your Google account. | |
// Thanks: http://www.abstractioneer.org/2009/12/openid-delegation-for-googles-op.html | |
--> | |
<link rel="openid2.provider" href="https://www.google.com/accounts/o8/ud?source=profiles" > | |
<link rel="openid2.local_id" href="http://www.google.com/profiles/[your_google_profile_name]" > |
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
{!-- Displays the number of new ExpressionEngine members by month --} | |
{exp:query sql="select count(*) AS total, month(from_unixtime(join_date)) as month, year(from_unixtime(join_date)) as year from exp_members group by year, month order by year DESC, month DESC"} | |
<br/>{year}-{month}: {total} | |
{/exp:query} |
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
// pass a function as a parameter of another function | |
function doAnotherThing() { | |
console.log('Doing another thing…'); | |
} | |
function doSomething(callback) { | |
console.log('Doing something…'); | |
if (typeof callback == 'function') { | |
callback.call(); |
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
1) In your Dropbox directory, create a new directory called SublimeUserPackages | |
2) Open terminal | |
3) Go to Sublime's packages directory | |
cd ~/Library/Application Support/Sublime Text 2/Packages | |
4) Copy the user packages to your new dropbox folder | |
cp -rp User/* ~/Dropbox/SublimeUserPackages/ |
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
# ---------------------------------------------------------------------- | |
# Password protect staging server | |
# Use one .htaccess file across multiple environments | |
# (e.g. local, dev, staging, production) | |
# but only password protect a specific environment. | |
# ---------------------------------------------------------------------- | |
SetEnvIf Host staging.domain.com passreq | |
AuthType Basic | |
AuthName "Password Required" |
OlderNewer