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
function isPalindrome(string) { | |
string = ""+string; | |
var len = string.length; | |
if (len<=1) { | |
return true; | |
} | |
if (string[0] === string[len-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
<?php | |
// For "aabcd" returns "a: 2, b: 1, c: 1, d: 1" | |
function charOccurrences($str) { | |
$occurrences = []; | |
$len = strlen($str); | |
if ($len > 0) { | |
$chars = str_split($str); | |
foreach($chars as $char) { | |
if (array_key_exists($char, $occurrences)) { |
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 zeroFill = function(num, zeros) { | |
return (Array(zeros).join("0") + num).slice(-zeros); | |
}; |
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 | |
require "vendor/autoload.php"; | |
use Abraham\TwitterOAuth\TwitterOAuth; | |
// You can get all these via https://dev.twitter.com/ | |
$consumer_key = ""; | |
$consumer_secret = ""; | |
$access_token = ""; | |
$access_token_secret = ""; | |
$user_id = 0; // Twitter user ID |