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
#include <stdio.h> | |
#include <unistd.h> | |
#include <stdlib.h> | |
#include <sys/types.h> | |
#include <sys/stat.h> | |
#include <dirent.h> | |
#include <string.h> | |
/* | |
* A NON-CONSTANT VARIABLE |
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
// Match alphanumeric strings, with at least one number and one character. | |
// ----------------------------------------------------------------------- | |
( // Find a group of: | |
[0-9]+[a-z] // - one or more digits, followed by a character. | |
| // - OR | |
[a-z]+[0-9] // - one or more characters, followed by a digit. | |
) | |
[a-z0-9]* // Then, 0 or more digits or characters. | |
// Match hexadecimal strings, with at least one number and one character. |
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 find = function(list, property) { | |
return list.map(function(x) { return x[property]; }).sort(); | |
}; |
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
find_dupes = function (list1, list2) { | |
return list1.filter(function(x) { return list2.indexOf(x) > -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
/** | |
* A tool for yielding items incrementally from a list. | |
* Usage: | |
* var gen = Generator([1, 2, 3], 0); | |
* gen.next(); // Yields 1 | |
* gen.next(); // Yields 2 | |
* gen.previous(); // Yields 1 | |
* | |
* @author JT Paasch | |
* @license MIT <http://opensource.org/licenses/MIT> |
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
#!/bin/bash | |
# We want to clear out the "rc" branch. To do that, we need | |
# to be on a different branch. We'll get onto "master". | |
# Does master exist? The first command's status code | |
# will be "0" if the branch exists. | |
git show-ref --verify --quiet refs/heads/master | |
MASTER_EXISTS=$? |
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
-- For working with HTTP. | |
import Network.HTTP | |
-- The `getRequest x` function takes a string (the URL you want to fetch) | |
-- and builds a GET `Request` object. Let's remap that to a function | |
-- called `build_get_request`: | |
build_get_request url = getRequest url | |
-- The `simpleHTTP` function takes a `Request` object and performs | |
-- the request. It returns a `Response` object, wrapped in the IO Monad. |
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
{-# LANGUAGE OverloadedStrings #-} | |
-- We need all of these. | |
import Data.Aeson | |
import Control.Applicative | |
import Control.Monad | |
import qualified Data.ByteString.Lazy.Char8 as BSL | |
-- Create a haskell data type called `Person`. | |
-- Persons have a name and an age. |
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
/** | |
* This function takes a string and tells you | |
* if the string represents an integer. | |
* All characters of the string must be digits, | |
* and there cannot be any leading zeros. | |
* | |
* @param String $string The string to check. | |
* @return Boolean | |
*/ | |
function is_this_string_an_integer($string) { |
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
#!/usr/bin/env bash | |
# A function to display usage. | |
function usage() { | |
echo "-- MY PROGRAM --" | |
echo "My program that does stuff." | |
echo "" | |
echo "USAGE:" | |
echo " $PROGRAM_NAME <command>" |