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
^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$ |
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
=link_to image_tag("image.png", :alt => 'The Alt Tag'), 'http://google.com', :title => 'Title' |
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
var userChoice = prompt("Do you choose rock, paper or scissors?"); | |
var computerChoice = Math.random(); | |
if (computerChoice < 0.34) { | |
computerChoice = "rock"; | |
} else if(computerChoice <= 0.67) { | |
computerChoice = "paper"; | |
} else { | |
computerChoice = "scissors"; | |
} |
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
.icon{:data => {:comments => 1}} |
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
var kkeys = [], konami = "38,38,40,40,37,39,37,39,66,65"; | |
$(document).keydown(function(e) { | |
kkeys.push( e.keyCode ); | |
if ( kkeys.toString().indexOf( konami ) >= 0 ) { | |
$(document).unbind('keydown',arguments.callee); | |
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 | |
$alphabet=array(); | |
/* Create lower Case Alphabet */ | |
for($i=97;$i<123;$i++) $alphabet[]=chr($i); | |
/* Convert to Uppercase */ | |
$upperCaseAlphabet = array_map('strtoupper',$alphabet); | |
?> |
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 | |
/* Find all image files in image folder */ | |
$images = glob($imagePath.'*.{gif,jpeg,jpg,png}',GLOB_BRACE); | |
?> |
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 | |
/* Load flickr Public Feed */ | |
$xml = simplexml_load_file('http://api.flickr.com/services/feeds/photos_public.gne'); | |
if(is_object($xml)){ | |
/* Get each entry and echo the content tag */ | |
foreach($xml->entry as $photo) echo $photo->content; | |
} | |
?> |
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 | |
$hash = password_hash($password, PASSWORD_BCRYPT, ['cost' => 20]); | |
?> |
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 | |
$successful = usort($students, function ($a, $b) { | |
return $a['age'] - $b['age']; | |
}); | |
?> |