Skip to content

Instantly share code, notes, and snippets.

View djanatyn's full-sized avatar

Jonathan Strickland djanatyn

View GitHub Profile
@djanatyn
djanatyn / prime.pl
Created August 31, 2011 18:45
find prime numbers
#!/usr/bin/perl -w
use strict;
sub check_prime {
my ($max) = @_;
for my $x (2 .. ($max - 1)) { if ($max % $x == 0) { return 1; } }
return 0;
}
for my $x ( 1..100 ) {
@djanatyn
djanatyn / gist:1196053
Created September 5, 2011 22:19
my emacs config
;; djanatyn's emacs config
;; feel free to debug or use, or whatever.
;; set load path
(add-to-list 'load-path "~/.emacs.d/sitelisp/")
(load "~/.emacs.d/cperl-mode.el")
;; open with *scratch* buffer
(setq inhibit-splash-screen t)
class Person
attr_accessor :name, :age
def initialize(name,age)
@name = name
@age = age.to_i
end
def inspect
"#@name (#@age)"
end
end
@djanatyn
djanatyn / gist:1206339
Created September 9, 2011 14:17
a simple python script
TOTAL_DISTANCE = 150000
COST_OF_GAS = 4
class car:
def __init__(self,mpg,cost):
self.mpg = mpg
self.cost = cost
cars = [ car(250,5000), car(600,900000), car(3000,20) ]
costs = []
@djanatyn
djanatyn / gist:1206375
Created September 9, 2011 14:30
a simple perl script
#!/usr/bin/perl -w
use strict;
use warnings;
$TOTAL_DISTANCE + 150000;
$PRICE_PER_GALLON = 4;
my @cars = [
{ 'mpg' => 250, cost => '5000' },
{ 'mpg' => 250, cost => '5000' },
@djanatyn
djanatyn / gist:1212674
Created September 12, 2011 22:37
an algorithm thingy in perl
#!/usr/bin/perl -w
use strict;
use warnings;
my $TOTAL_DISTANCE = 150000;
my $PRICE_PER_GALLON = 4;
my @cars = (
{ mpg => 300, cost => '5000' },
{ mpg => 250, cost => '5000' },
@djanatyn
djanatyn / gist:1216966
Created September 14, 2011 16:05
sieve of eratosthenes :D
#!/usr/bin/perl -w
use strict;
use warnings;
my $max = 100;
my @array;
for ( 1 .. $max ) { $array[$_] = 1; }
for ( 2 .. $max ) {
my $i = 2;
@djanatyn
djanatyn / index.html
Created September 16, 2011 18:22
the beginning of a development blog
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css" />
<title>Hello world!</title>
</head>
<body>
<center>
<br/>
<div id="container">
<img src="tux.png" align="right" />
fizzBuzz n
| mod n 3 == 0 && mod n 5 == 0 = "FizzBuzz"
| mod n 3 == 0 = "Fizz"
| mod n 5 == 0 = "Buzz"
| otherwise = show n
main = do
theFizzies = map fizzBuzz [1..100]
putStrLn $ show theFizzies
movies to watch
===============
(that movie about the engineer and the time traveller that mr. miller saw)
pan's labyrinth
children of men
fight club
the shawshank redemption
the lives of others
a beautiful mind