Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@JFFail
JFFail / check-palindrome.ps1
Created September 15, 2015 20:44
Reddit Daily Programmer #232
#https://www.reddit.com/r/dailyprogrammer/comments/3kx6oh/20150914_challenge_232_easy_palindromes/
$lines = 2
$counter = 0
$text = ""
while($counter -lt $lines) {
$temp = Read-Host "Enter text"
$temp = $temp.ToCharArray()
foreach($letter in $temp) {
$letter = [string]$letter
@JFFail
JFFail / dottie-numbers.ps1
Created August 25, 2015 00:05
Reddit Daily Programmer #229
#https://www.reddit.com/r/dailyprogrammer/comments/3i99w8/20150824_challenge_229_easy_the_dottie_number/
$number = Read-Host "Enter a number"
do {
$previous = $number
$number = [math]::Cos($number)
} while($number -ne $previous)
Write-Host $number
@JFFail
JFFail / order-letters.ps1
Created August 19, 2015 13:28
Solution To Reddit Daily Programmer #228
#https://www.reddit.com/r/dailyprogrammer/comments/3h9pde/20150817_challenge_228_easy_letters_in/
function CheckOrder {
param($Word)
#Place the word into an array.
$charArray = $Word.ToCharArray()
$sortedArray = $charArray | Sort-Object
#See if they match.
$match = $true
@JFFail
JFFail / generate-password.ps1
Last active August 29, 2015 14:26
PowerShell script to generate a random password of specified length and complexity.
#Stupid test script to generate a random, possibly complex password.
param
(
[Parameter(Mandatory=$true)]
[int]$Length,
[Parameter(Mandatory=$false)]
[switch]$Complexity
)
function MakePassword
@JFFail
JFFail / shuffle.pl
Last active August 29, 2015 14:25
Solution To Reddit Daily Programmer #224 - Shuffling A List
!/usr/bin/env perl
use warnings;
use strict;
sub shuffle_stuff {
#Turn the values into an array.
my $values = shift;
my @values = split(" ", $values);
#Figure out length. Create an array of index and a final value array.
@JFFail
JFFail / garland.pl
Created July 15, 2015 12:02
Solution to Reddit Daily Programmer #223 - Garland
#!/usr/bin/env perl
use warnings;
use strict;
sub garland {
use integer;
my $word = shift;
print "$word - ";
my @word_array = split("", $word);
my $length = @word_array;
@JFFail
JFFail / balance.pl
Last active August 29, 2015 14:24
Solution to Reddit Daily Programmer #222 - Balancing Words
#!/usr/bin/env perl
# Solution To Reddit Daily Programmer 222
# http://www.reddit.com/r/dailyprogrammer/comments/3c9a9h/20150706_challenge_222_easy_balancing_words/
use warnings;
use strict;
#Function to balance the word.
sub balance {
my $input = shift;
my $word_len = length($input);
@JFFail
JFFail / snake.pl
Created July 1, 2015 01:04
Reddit Snake Challenge in Perl
#!/usr/bin/env perl
use warnings;
use strict;
my $base_word = "SHENANIGANS SALTY YOUNGSTER ROUND DOUBLET TERABYTE ESSENCE";
my @word_array = split(/\s+/, $base_word);
my $counter = 0;
my $spaces = "";
@JFFail
JFFail / mangle-sentence.ps1
Created June 30, 2015 12:45
Solution to Reddit Daily Programmer #220 - Mangle Sentence
#Solution to Reddit Daily Programmer #220
#http://www.reddit.com/r/dailyprogrammer/comments/3aqvjn/20150622_challenge_220_easy_mangling_sentences/
#Original input.
#$sentence = "This challenge doesn't seem so hard."
#$sentence = "Eye of Newt, and Toe of Frog, Wool of Bat, and Tongue of Dog."
#$sentence = "For a charm of powerful trouble, like a hell-broth boil and bubble."
$sentence = "Adder's fork, and Blind-worm's sting, Lizard's leg, and Howlet's wing."
#Make it into an array of words.
$sentenceArray = $sentence.Split(" ")
@JFFail
JFFail / snake.ps1
Created June 29, 2015 19:52
Solution to Reddit Daily Programmer #221 - Word Snake
#http://www.reddit.com/r/dailyprogrammer/comments/3bi5na/20150629_challenge_221_easy_word_snake/
$words = "SHENANIGANS SALTY YOUNGSTER ROUND DOUBLET TERABYTE ESSENCE"
$wordArray = $words.Split(" ")
$counter = 0
$space = ""
foreach($word in $wordArray)
{
if($counter % 2 -eq 0)
{