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
module Cellular where | |
import System.Random | |
import Data.List.Split | |
import Data.Maybe | |
isWall False = '.' | |
isWall True = '#' | |
mapWithIndex :: (Enum a, Num a) => (a -> b -> c) -> [b] -> [c] |
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
# Validations added in an instance hook: | |
model.after_validation_hook { model.errors.add("random_attribute", 'Unrecognized attribute') } | |
# Later: | |
> model.valid? | |
=> false | |
> model.errors | |
=> {"random_attribute"=>["Unrecognized attribute"]} |
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
print "partay!!" |
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
function my_garland_preprocess_views_view__principles(&$vars) { | |
$vars['test'] = 'Hi!!!'; | |
} |
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" | |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> | |
<title>untitled</title> | |
<style type="text/css"> |
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
require 'rubygems' | |
require 'scrubyt' | |
photos = Scrubyt::Extractor.define :agent => :firefox do | |
fetch 'http://alexanderkahn.deviantart.com/gallery' | |
link_title "//a[@class='t']", :write_text => true do | |
link 'href', :type => :attribute | |
end | |
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
function sti_migrate_import($options, &$context) { | |
// For node_object_prepare() | |
module_load_include('inc', 'node', 'node.pages'); | |
module_load_include('inc', 'filefield', 'field_file'); | |
$query = 'SELECT * FROM {sti_stories} ORDER BY imagefile DESC'; | |
$context['sandbox']['progress'] = 0; | |
$context['sandbox']['results'] = array(); | |
$context['sandbox']['max'] = $options['count']; | |
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
$(document).ready(function(){ | |
$('#edit-taxonomy-3-wrapper select').change(function() { | |
if ($('option:selected',this).html() == 'Other...') { | |
$('#edit-field-i-am-other-0-value-wrapper').slideDown('fast'); | |
} | |
else { | |
$('#edit-field-i-am-other-0-value-wrapper').slideUp('fast'); | |
} | |
}); | |
}); |
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
/** | |
* Zips must be 5-digit integers and email addresses must be valid. | |
*/ | |
function email_zip_validate($form, &$form_state) { | |
if (!is_numeric((int)$form_state['values']['zip']) || strlen($form_state['values']['zip']) != 5) { | |
form_set_error('zip', t('The zip code you entered was not valid. Please try entering it again.')); | |
} | |
if (!valid_email_address($form_state['values']['email'])) { | |
form_set_error('email', t('The email address you entered was not valid. Please try entering it again.')); | |
} |
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
for (i = 0; i++; i < 10) { | |
$('.view-featurebox').after('hi'); | |
} |
OlderNewer