Skip to content

Instantly share code, notes, and snippets.

View iturgeon's full-sized avatar
👻
The answer is YES

Ian Turgeon iturgeon

👻
The answer is YES
View GitHub Profile
@iturgeon
iturgeon / print_stairs.rb
Last active February 8, 2017 19:31
Whiteboard wednesday - print stairs
# n | 0 1 2 3 4 5
# i |____________
# 1 | _ _ _ _ _ #
# 2 | _ _ _ _ # #
# 3 | _ _ _ # # #
# 4 | _ _ # # # #
# 5 | _ # # # # #
# 6 | # # # # # #
@iturgeon
iturgeon / nthFromEnd.js
Created February 1, 2017 21:59
Nth item from the end of a list
"use strict";
let nthFromEnd = (startNode, n) => {
let rabbit = startNode;
let turtle = startNode;
while(n--){
rabbit=rabbit.nextNode;
}
while(rabbit){
rabbit=rabbit.nextNode;
@iturgeon
iturgeon / nthFromEnd.rb
Last active February 2, 2017 16:06
Find Nth from end of a linked list
class Node
attr_accessor :nextNode, :value
def initialize(value, nextNode = nil)
@value = value
@nextNode = nextNode
end
end
def nthFromEnd(startNode, n)
rabbit = turtle = startNode
@iturgeon
iturgeon / firefox_ssh_proxy.md
Last active January 23, 2017 15:07
Firefox - Proxy connections through SSH from another server

SSH as [email protected], creating a SOCKS proxy on port 8123

In Firefox, set a manual SOCKS v5 proxy config for localhost on port 8123

ssh -D 8123 -C -q -N [email protected] add -f if you want to background the process

@iturgeon
iturgeon / README.md
Last active October 30, 2023 14:06
How to run phpMyAdmin using the built in php webserver

Running phpMyAdmin localy on the built in php server

  1. make sure you have php 5.3+: run php -v
  2. Download phpmyadmin (github or main website)
  3. In the root directory, copy config.sample.inc.php > config.inc.php
  4. Edit config.inc.php, set $cfg['Servers'][$i]['host'] to the ip address of your mysql server (probably localhost or 127.0.0.1)
  5. In the root phpmyadmin directory run php -S localhost:8080
  6. open in your browser: http://localhost:8080
  7. log in by entering some valid credentials (a user you added or the root user)
### Keybase proof
I hereby claim:
* I am iturgeon on github.
* I am iturgeon (https://keybase.io/iturgeon) on keybase.
* I have a public key whose fingerprint is 7932 3DB4 2863 FE6C EAAD 7428 13E1 B683 23C5 069E
To claim this, I am signing this object:
@iturgeon
iturgeon / BatchQuery.php
Last active August 29, 2015 14:10
FuelPHP Batch insert Class
<?
/**
* BatchQuery allows you to do mass mysql inserts easily and quickly
*/
class BatchQuery
{
private $db;
private $batchSize = 0;
private $batchLimit = 200;
@iturgeon
iturgeon / the same thing.rb
Last active August 29, 2015 14:08
playing with blocks
def js(*files)
content_for(:js) { javascript_include_tag(*files.map { |file| "/assets/js/#{file}"}) }
content_for(:js) do
javascript_include_tag(*files.map { |file| "/assets/js/#{file}"})
end
content_for(:js) do
derp = Proc.new { |file| "/assets/js/#{file}"}
javascript_include_tag *files.map(&derp)
@iturgeon
iturgeon / gist:4588221fc687008aed7f
Created August 12, 2014 23:39
Possible FuelPHP routing solution for dealing with 500s
<?
try
{
$response = Request::forge()->execute()->response();
}
catch (Exception $e)
{
$errorMap = [
'HttpNotFoundException' => '_404_',
var properties = [
{
"name":"Fish Hatchery Road",
"permalink":"Fish-Hatchery-Road",
"price":"$375,000",
"address":"998 Fish Hatchery Rd Lakeland, Fl 33801",
"description":"Once you step onto this property, you start to dream of the possibilities; from its size - 81 total acres- of which 45 are beautiful upland pastures and woodlands, its picturesque makeup, its location adjacent to Saddle Creek Park to its favorable Land Use designation, this property intrigues.",
"lot_size":"45 AC",
"land_use":"Leisure/Recreation (LR)",
"lake_frontage":"6,820' of dynamic shoreline - Saddle Creek Park",