Skip to content

Instantly share code, notes, and snippets.

Matthew Manning mattmanning

Block or report user

Report or block mattmanning

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mattmanning
mattmanning / timestamps.md
Created Aug 17, 2019
Localized timestamps
View timestamps.md

jQuery snippet to display a timestamp in local time zone and language

$(function() {
  $.each($('.timestamp'), function(i, v) {
	  ts = $(v)
		ts.text((new Date(ts.text())).toLocaleString());
	})
});
View pe13.rb
# Project Euler 13
data = <<~DATA
37107287533902102798797998220837590246510135740250
46376937677490009712648124896970078050417018260538
74324986199524741059474233309513058123726617309629
91942213363574161572522430563301811072406154908250
23067588207539346171171980310421047513778063246676
89261670696623633820136378418383684178734361726757
28112879812849979408065481931592621691275889832738
View postgres_queries_and_commands.sql
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
View blog.md

Making Your Own Blog

This tutorial will walk you through making your own blog. To build it, we're going to use the Ruby programming language and a web library for it called Sinatra.

Getting started

Before we start we need to install a couple of tools. Ruby is an "interpreted" programming language, so we'll install a special program called an interpreter that will run your Ruby code. The installer also includes some other tools that help you out when building Ruby programs.

Hello World!

View gist:9901435
-----BEGIN PGP MESSAGE-----
Version: GnuPG v1
hQEMAyolo95N7fZGAQf/ZdJBUQsDTe/kIz+wzYv21wzIp5HQV62G8dxVTd9VFZ6R
Zu/Q+WWuwzE70Cykh7bkO4uPVhQhuYciw7iGVkuKqtN/2besBn59jzc6h1nlbcX2
76tsHfCZ9nnyTH8Q+Heav+E9d3blxZol3FjQGuTecjNpA3M6Ljq6GgI7KFL2B4JW
5aBBIoyyi9SScP9+PAof5FRpzMsuVqIzrdFwyeR6Bh0+1KBqfy9WZ0p6v/67eBnw
dFGyx9mXJ70Wvrm3LBqScGNNEocKC+OLlpfV4s2m3TZCNRz9HBivHmBVYSrZtfVs
eXWpVxxoVX0kFI06g0wnqUfb3oAYr5FLOdyH61akb9I3ARW7dadkVrifmKLb85KN
fVW1rDzxvL3qaymdaME+Y8NZ1iPES26TEZ9vK+tL00gSmjB/yV7CCw==
View NES games
Baseball Stars
Battletoads
Bionic Commando
Blaster Master
Bubble Bobble
Castlevania 2 - Simon's Quest
Castlevania III: Dracula's Curse
Castlevania
Contra
Crystalis
View keybase.md

Keybase proof

I hereby claim:

  • I am mattmanning on github.
  • I am mattmanning (https://keybase.io/mattmanning) on keybase.
  • I have a public key whose fingerprint is D38E DA93 16C3 86D4 3B6D 3630 2842 8B94 6FE4 686D

To claim this, I am signing this object:

@mattmanning
mattmanning / vim questions
Last active Dec 29, 2015
I'm trying to learn vim. These are unanswered questions I have.
View vim questions
I use the "find in project" feature of TextMate a lot. What's a good vim plugin for that? I can fall back on grep on the terminal, but it would be nice to do it in the editor and open files directly from search results.
Is there any way to do fuzzy filename matching / completion with the :edit command?
How do I get it to handle indentations in Ruby code correctly? (2 spaces soft tabs)
@mattmanning
mattmanning / pi.rb
Created Aug 6, 2012
Estimate pi using random points and the distance formula
View pi.rb
#!/usr/bin/env ruby
#
# Estimate pi using 1 random point:
# ./pi.rb 1
#
# Estimate pi using 1000 random points:
# ./pi.rb 1000
class Point
def initialize
You can’t perform that action at this time.