Skip to content

Instantly share code, notes, and snippets.

View camh96's full-sized avatar
Watching the game

Cam Hovell camh96

Watching the game
View GitHub Profile
require 'date'
require 'active_support/time'
current_id = 100000000026499683
starting_date = Date.new(2019,03,05)
times = [
[9, 0, 60],
[11, 30, 30],
@camh96
camh96 / regex
Created July 17, 2018 20:55
regex to match a number in parentheses
(\([\d]?\.[\d]*\))|(\(\d\))
@camh96
camh96 / 3.py
Last active November 12, 2017 23:21
James Andersen python stuff
__author__ = 'Cam Hovell'
var = True
while var:
my_input = input('Enter a letter: ')
my_input = my_input.lower() # make input lowercase so easier to make logic for it
if my_input[0] == 'n' or my_input[0] == 'y': # get first letter of input, so y, yes, yeah, nah, nope all work
print('You entered {}'.format(my_input)) # prints formatted, with my_input var as a paramter
var = False # set var to false so we stop looping
@camh96
camh96 / time.php
Last active August 29, 2015 14:23
<?php
// header("refresh: 300"); //refresh every 5 mins
session_start();
date_default_timezone_set("Pacific/Auckland");
$initvars = json_decode(file_get_contents("https://maps.googleapis.com/maps/api/distancematrix/json?origins=Tawa+Wellington&destinations=Willis+St+NZ&key=AIzaSyD7shuOovfRpwCjPKq3TMwticEhDALRxcI"), true);
echo "<pre>";
$vals = $initvars["rows"][0]["elements"][0]["duration"]["text"];
$output = preg_replace('/[^0-9]/', '', $vals);
echo $output . " minutes to get to Willis St from Tawa as at " . date("H:i:s", time());
echo "<br>";
@camh96
camh96 / map.html
Created June 18, 2015 02:33
map.html
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<title>Complex icons</title>
<style>
html, body, #map-canvas {
height: 80%;
margin: 0px;
<!DOCTYPE html>
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Get some bible verses</title>
<link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.5.0/pure-min.css">
<style>
body
{
width: 100%;
@camh96
camh96 / dbconnect.php
Last active August 29, 2015 14:05 — forked from Danni3/dbconnect.php
<?php
$username = "root";
$password = "";
$hostname = "localhost";
$dbname = "assessment";
$con = mysqli_connect($hostname, $username, $password, $dbname);
// check connection
if (mysqli_connect_errno())
<?php
$username = "root";
$password = "";
$hostname = "localhost";
$dbname = "assessment";
$con = mysqli_connect($hostname, $username, $password, $dbname);
// check connection
if (mysqli_connect_errno())

Tinder API documentation

http://rsty.org/

I've sniffed most of the Tinder API to see how it works. You can use this to create bots (etc) very trivially. Some example python bot code is here -> https://gist.github.com/rtt/5a2e0cfa638c938cca59 (horribly quick and dirty, you've been warned!)

Note: this was written in April/May 2014 and the API may have changed since

API Details

@camh96
camh96 / connect.php
Last active August 29, 2015 14:05
Connecting to mySQL
<?php
$con=mysqli_connect("localhost","Staff","FhsJGLRf35weaHzNf","news");
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL because " . mysqli_connect_error();
}
$ok= echo "Yep, everything seems in order!";
if (!mysqli_query($con,$ok))
{