Skip to content

Instantly share code, notes, and snippets.

View artlung's full-sized avatar
💭
🤖

Joe Crawford artlung

💭
🤖
View GitHub Profile
@artlung
artlung / temp.diff
Created March 11, 2010 00:38
diff.diff
40c40
< <div id="logo">
---
> <div id="logo" style="z-index: 2">
84d83
<
794,800c793,797
< <div id="google_translate_element"></div><script>
< function googleTranslateElementInit() {
< new google.translate.TranslateElement({
This is me waking up in the twenty-first century and saying, "Hold the phone! I can still go online and have all my presents delivered by Christmas Eve without paying exorbitant shipping costs." (I recommend <a href="http://www.williams-sonoma.com/search/results.html?words=candy&dspCat=Candy%20&%20Chocolate&category=candy-chocolate">Williams-Sonoma's candy selection</a> and anything you can afford fro<!-- -->m <a href="http://www.cartoonbank.com/gift_collection.asp">this place that Jack cannot click on</a>.)
DELETE FROM wp_posts WHERE post_type = "revision";
@artlung
artlung / wordpress-custom-field-functions.php
Created March 15, 2010 17:36
is it possible to pass the value of a custom field to a function in functions.php?
<p>is it possible to pass the value of a custom field to a function in functions.php?</p>
<p>Way #1</p>
<?php
// one way would be to pass in the post ID
function yourSpecialFunction($post_id) {
$custom_field = get_post_meta($post_id, 'my_custom_field', true);
// do something with $custom_field
return;
<?php
// this goes in functions.php in your theme. Then you can use shortcode [most_commented] in posts and pages
// to get the top 150 posts
function mostCommented() {
echo '<p>';
$posts_per_page = 150;
query_posts('orderby=comment_count&posts_per_page='.$posts_per_page.'&order=DESC');
if ( have_posts() ) : while ( have_posts() ) : the_post();
echo '<a href="';
<!-- the big 4 oh -->
<div align="center"><div style="height: 300px;width:500px;overflow:hidden;background-color:#f84;border:30px solid #000;"><p style="font-size:540px;margin:0;padding:0;letter-spacing:-40px;font-weight:bold;font-family:helvetica,arial,sans-serif;line-height:200px">40</p></div></div>
var LAAL = {
init : function() {
var that = this;
$('#MenuText ul li a').bind('mouseover', function() {
var id = '#show_' + $(this).parents('li:first').attr('id').split('_')[1];
var offset = $(this).parents('li:first').offset();
$('.subMenu').hide();
if (!$(this).parents('li:first').hasClass('noMenu')) {
that.showMenu(id, offset);
}
@artlung
artlung / jquery-example.html
Created May 1, 2010 17:20
A simple hello world jQuery example
<html>
<head>
<title>My Sample</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
var new_num = 40; // global variable
jQuery(document).ready(function(){
http://api.jquery.com/css/
$('p').css({border: '5px solid red', color: 'green', padding: '20px'});
@artlung
artlung / another-example-jquery.html
Created May 1, 2010 17:46
random-color-jquery.html
<html>
<head>
<title>My Random Color Sample</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
var new_num = 40; // global variable
function randomWebColor() {
var number_of_colors = 0xffffff;
var num = Math.round(Math.random() * number_of_colors);
@artlung
artlung / lottery.py
Created May 19, 2010 00:30
Lottery Python Program
"""A simple lottery to demonstrate module and script interaction in Python."""
import random
PEOPLE = ('Dale', 'Will')
def winner(people=PEOPLE):
"""Choose a winner at random from the given list of people."""
x = random.randrange(0,len(people))
return people[x]