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
fizzbuzz :: Int -> String | |
fizzbuzz n | |
| mod n 3 == 0 && mod n 5 == 0 = "FizzBuzz" | |
| mod n 3 == 0 = "Fizz" | |
| mod n 5 == 0 = "Buzz" | |
| otherwise = show n | |
main = mapM (print . fizzbuzz) [0..100] |
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
array=(a b c d e) | |
search=d | |
if [[ ' '${array[*]}' ' =~ ' '$search' ' ]]; then | |
echo 'It exists!' | |
fi |
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
#The point or points of the code hereafter, which obtains the argument given | |
#before the character which would cause the system to execute the aforementioned | |
#code (which is also the code hereafter), is to take the aforementioned | |
#argument, which should be a string of characters that would fit within the | |
#following regular expression: | |
#/[[NO, I say, bad jane is unfortunately deceased.\]]+/ | |
#and convert it to an obfuscated JavaScript string that matches the following | |
#regular expression: | |
#/.*/ | |
from re import finditer |
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
$.ajax({ | |
dataType: 'jsonp', | |
jsonp: 'callback', | |
url: 'http://search.twitter.com/search.json?q=%23fwgangnamstyle', | |
success: function(obj) { | |
for (var i = 0, j = obj.results.length; i < j; ++i) { | |
var user = obj.results[i].from_user; | |
var tweet_text = obj.results[i].text.replace(/#[\w\d]+/g, "<a href=\"https://twitter.com/$&\" target=\"_blank\">"); | |
var html = "<li><a href=https://twitter.com/" + user + ">@" + user + "</a> said " + tweet_text + "</li>"; | |
console.log(obj.results[i]); |
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
$.ajax({ | |
dataType: 'jsonp', | |
jsonp: 'callback', | |
url: 'http://search.twitter.com/search.json?q=%23fwgangnamstyle', | |
success: function(obj) { | |
for (var i = 0; i <= obj.results.length - 1; ++i) { | |
var user = obj.results[i].from_user; | |
var tweet_text = obj.results[i].text.replace(/#[\w\d]+/g, "<a href=\"https://twitter.com/$&\" target=\"_blank\">"); | |
var html = "<li><a href=https://twitter.com/" + user + ">@" + user + "</a> said " + tweet_text + "</li>"; | |
console.log(obj.results[i]); |
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(){ | |
$("#tweet-feed").twitterfly({ | |
feeds : [ | |
{ | |
handle : "#FWGangnamStyle" | |
} | |
], | |
tweet_html : '<div><table cellspacing="0" cellpadding="0" border="0" class="tweet-box"><tr><td class="imgcell"><a href="http://twitter.com/{{HANDLE}}" target="_blank"><img src="{{IMAGE}}" alt=""></img></a></td><td><div class="tweet-user"><a href="http://twitter.com/{{HANDLE}}" target="_blank">{{HANDLE}}</a><span> on {{TIME}}</span></div><div class="tweet-text">{{TWEET}}</div></td></tr></table></div>' | |
}); | |
}); |
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 | |
//This is what I'm considering for validation. It should work both in JavaScript and PHP, and should only have to be written out in the configuration. | |
$validate = array( | |
'first_name' => 'filled|name|max:64', //Max size of the field can only be 64 | |
'last_name' => 'required|equals:[Jones, James, Smith]|max:64', //'required' is the same as 'filled', and this will only validate if the last name is Jones, James, or Smith. | |
'middle_name' => 'optional|equals:Danger', //'optional' itself is optional. This will only validate if the middle name is Danger. | |
'Title' => 'optional|truncate:5' //This will always validate, but if any value is entered that is longer than 5 characters, it will truncate it down to 5 characters. | |
); |