Skip to content

Instantly share code, notes, and snippets.

var coordsToAngle = function(c){
if(typeof c == Array && c.length==3)
var deg = c[0], min = c[1], sec = c[2];
else {
var deg = c.match(/([\-]?[\d]{1,3})\°/), deg = (deg === null ? 0 : deg[1].toInt());
var min = c.match(/([\-]?[\d]{1,3})\'{1}/), min = (min === null ? 0 : min[1].toInt());
var sec = c.match(/([\-]?[\d]{1,3})\'{2}/), sec = (sec === null ? 0 : sec[1].toInt());
}
c = deg + min/60 + sec/3600;
return c;
import java.util.Scanner;
import java.text.DecimalFormat;
public class TrigLength
{
public static void main (String[] args) {
Scanner scan = new Scanner(System.in);
import java.util.Scanner;
public class VaccineTest
{
public static void main (String[] args) {
while(true){
Scanner scan = new Scanner(System.in);
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=8" />
<title>Big Movie Weekend - Home</title>
<style type="text/css" media="screen">
@import "http://www.virginmedia.com/partners/movies/ostmodern/vm.css";
@raphaelsaunier
raphaelsaunier / events2template.php
Created March 29, 2011 13:53
Planet Earth Institute Worldwide - Events template
<?php
/**
* Template Name: Events2
*
* @package peiFramework
* @subpackage Template
*/
/* See theme's functions.php for PetersDateConverter() function */
@raphaelsaunier
raphaelsaunier / bnpnn.py
Created May 23, 2011 19:25
Back-Propagation Neural Networks by Neil Schemenauer <[email protected]>
# Back-Propagation Neural Networks
#
# Written in Python. See http://www.python.org/
# Placed in the public domain.
# Neil Schemenauer <[email protected]>
import math
import random
import string
@raphaelsaunier
raphaelsaunier / gist:1475972
Created December 14, 2011 10:07
TemperatureConverterGUI.java
// TemperatureConverterGUI.java
// Author: Laurencia Walker-Fooks
// Program last changed: 7 December 2011
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.awt.event.ActionListener;
public class TemperatureConverterGUI extends JFrame
@raphaelsaunier
raphaelsaunier / table.html
Created January 6, 2012 11:11
Table example
<table border="0" cellspacing="5" cellpadding="5" style="border:0;border-collapse:collapse;">
<tr><th colspan="2">Live Barclays Premier League</th></tr>
<tr><td>Bolton v Liverpool</td><td>Saturday, 21st January, 4:30pm</td></tr>
<tr><th colspan="2">Clydesdale Bank Premier League</th></tr>
<tr><td>Dunfermline v Celtic</td><td>Monday, 2nd January, 2:30pm</td></tr>
<tr><td>Bolton v Liverpool</td><td>Saturday, 21st January, 4:30pm</td></tr>
<tr><td>Bolton v Liverpool</td><td>Saturday, 21st January, 4:30pm</td></tr>
<tr><td>Bolton v Liverpool</td><td>Saturday, 21st January, 4:30pm</td></tr>
<?php
$key = 'our passphrase here';
$hash = 'f8956ba8af19b58e6a92e234abfebf13';
// Encryption function we'll use on our side. This would be retrieved as $_POST['signature'] on your side.
$signature = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key), $hash, MCRYPT_MODE_CBC, md5(md5($key))));
$decrypted = rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($key), base64_decode($signature), MCRYPT_MODE_CBC, md5(md5($key))), "\0");
if($hash == $decrypted)
R version 2.14.2 (2012-02-29)
Copyright (C) 2012 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i386-apple-darwin9.8.0/i386 (32-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.