Skip to content

Instantly share code, notes, and snippets.

@wellingguzman
wellingguzman / cycle-list.php
Created July 6, 2018 21:53 — forked from chartjes/cycle-list.php
My PHP script for creating a Twitter list where people cycle on and off it based on 30 days of interaction
<?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
@wellingguzman
wellingguzman / zerofill.js
Last active August 29, 2015 14:10
Zero Fill - JavaScript
var zeroFill = function(num, zeros) {
return (Array(zeros).join("0") + num).slice(-zeros);
};
@wellingguzman
wellingguzman / gist:ebc592f431a8f21e9023
Created September 16, 2014 18:22
Characters Occurrences
<?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)) {
function isPalindrome(string) {
string = ""+string;
var len = string.length;
if (len<=1) {
return true;
}
if (string[0] === string[len-1])