- www.gideondsouza.com
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/perl | |
# Solution to projecteuler.net/problem=3 | |
# Question: | |
# The prime factors of 13195 are 5, 7, 13 and 29. | |
# What is the largest prime factor of the number 600851475143 ? | |
# Answer: 6857 | |
use strict; | |
use warnings; |
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
Awesome contents |
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
use strict; | |
use warnings; | |
############################################ | |
#__ __ _____ _ _ _____ _ _ _____ | |
#\ \ / /\ | __ \| \ | |_ _| \ | |/ ____| | |
# \ \ /\ / / \ | |__) | \| | | | | \| | | __ | |
# \ \/ \/ / /\ \ | _ /| . ` | | | | . ` | | |_ | | |
# \ /\ / ____ \| | \ \| |\ |_| |_| |\ | |__| | | |
# \/ \/_/ \_\_| \_\_| \_|_____|_| \_|\_____| |
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
print "SE"; |
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
use strict; | |
print "Hello"; |
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
<!doctype html> | |
<html> | |
<head> | |
<title>Dancr</title> | |
<link rel=stylesheet type=text/css href="<% css_url %>"> | |
</head> | |
<body> | |
<div class=page> | |
<h1>Dancr</h1> | |
<div class=metanav> |
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 is a utility method that will convert a query string into a hash | |
sub parse_query_str { | |
my $str = shift; | |
my %in = (); | |
if (length ($str) > 0){ | |
my $buffer = $str; | |
my @pairs = split(/&/, $buffer); | |
foreach my $pair (@pairs){ | |
my ($name, $value) = split(/=/, $pair); | |
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; |
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
get '/auth/github/callback' => sub { | |
#github sends us a code to authenticate. Here we need to retrieve it | |
my $code = params->{'code'}; | |
#create a new instance of LWP:UserAgent | |
my $browser = LWP::UserAgent->new; | |
#send a post request for an access token | |
my $resp = $browser->post('https://github.com/login/oauth/access_token', | |
[ | |
#these two are global variables in our dancer app | |
client_id => $client_id, |
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
#on the top | |
my $client_id = "YOUR CLIENT ID HERE"; | |
my $client_secret = "YOUR SECRET ID HERE"; | |
#route to login | |
get '/login' => sub { | |
#redirect the user to githubs login/authorize page | |
#we pass in a silly state (x12) ideally this should be generated | |
redirect "https://github.com/login/oauth/authorize?&client_id=$client_id&state=x12"; | |
}; |
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
@{ | |
Layout = null; | |
} | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="viewport" content="width=device-width" /> | |
<title>::Uploadify Example::</title> | |
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script> | |
<script type="text/javascript" src="@Url.Content("~/Scripts/jquery.uploadify-3.1.min.js")"></script> |