Skip to content

Instantly share code, notes, and snippets.

@jaysonrowe
jaysonrowe / FizzBuzz.js
Created January 11, 2012 01:39
FizzBuzz JavaScript solution
for (var i=1; i <= 20; i++)
{
if (i % 15 == 0)
console.log("FizzBuzz");
else if (i % 3 == 0)
console.log("Fizz");
else if (i % 5 == 0)
console.log("Buzz");
else
console.log(i);
@jaysonrowe
jaysonrowe / FizzBuzz.rb
Created January 11, 2012 03:03
FizzBuzz Ruby Solution
1.upto(20) do |i|
if i % 5 == 0 and i % 3 == 0
puts "FizzBuzz"
elsif i % 5 == 0
puts "Buzz"
elsif i % 3 == 0
puts "Fizz"
else
puts i
end
@jaysonrowe
jaysonrowe / FizzBuzz.py
Created January 11, 2012 03:05
FizzBuzz Python Solution
def fizzbuzz(n):
if n % 3 == 0 and n % 5 == 0:
return 'FizzBuzz'
elif n % 3 == 0:
return 'Fizz'
elif n % 5 == 0:
return 'Buzz'
else:
return str(n)
@jaysonrowe
jaysonrowe / FizzBuzzStepOne.js
Created January 11, 2012 11:57
FizzBuzz Codeacademy Step 1
for (var i=1; i <= 20; i++)
{
console.log(i);
}
@jaysonrowe
jaysonrowe / zip1.cs
Created January 26, 2012 21:31
Zip File using DotNetZip
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.IO.Compression;
using Ionic.Zip;
namespace testZip
{
@jaysonrowe
jaysonrowe / zip2.cs
Created January 26, 2012 21:32
Zip File using System.IO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.IO.Compression;
namespace testZip
{
class Program
@jaysonrowe
jaysonrowe / postfix.php
Created March 22, 2012 18:50
Parse e-mail with PHP
#!/usr/bin/php -q
<?php
// get mail via stdin
$email = file_get_contents("php://stdin");
// handle email
$lines = explode("\n", $email);
// set empty vars and explode message to variables
@jaysonrowe
jaysonrowe / emailfile
Created March 22, 2012 19:00
sample email
From jayson@localhost Thu Jan 5 10:04:48 2012
Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1])
by JaysonUbuntu (Postfix) with ESMTPS id 740AD380597
for <scott@localhost>; Thu, 5 Jan 2012 10:04:48 +0100 (CET)
Message-ID: <1325754288.4989.6.camel@JaysonUbuntu>
Subject: Important E-Mail
From: Jayson Rowe <jayson@jaysonrocks.com>
To: scott@scottsucks.com
Date: Thu, 05 Jan 2012 10:04:48 +0100
Content-Type: text/plain
@jaysonrowe
jaysonrowe / .bashrc
Created April 13, 2012 01:25
.bashrc
export PS1='\[\033[01;30m\]\t \[\e[0;36m\]\u\[\e[m\]@\[\033[00;32m\]\h\[\033[00;37m\]:\[\033[31m\]$(__git_ps1 "(%s)\[\033[01m\]")\[\033[0;34m\]\w\[\033[00m\] $ ';
@jaysonrowe
jaysonrowe / .bashrc2
Created April 22, 2012 02:02
.bashrc
PS1='\[\033[1;32m\][\u@\h \[\033[31m\]\W\[\033[34m\]$(__git_ps1 " (%s)")\[\033[1;32m\]]\\$\[\033[m\] '