Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am mfkp on github.
  • I am mfkp (https://keybase.io/mfkp) on keybase.
  • I have a public key whose fingerprint is FFB2 A9C3 8ACB 17E6 4F46 FC6C 63B6 A72D B053 6D1F

To claim this, I am signing this object:

@mfkp
mfkp / spam.rb
Created November 12, 2014 01:52
mail spammer for testing lots of emails
require 'net/smtp'
# instructions:
# set 2 environment variables: EMAIL & PW (assuming gmail in smtp settings)
# change from_domain to your email provider domain
# change from_name to your name
# change 'to' to the recipients of your spam
# run 'ruby spam.rb'
def sendMail(body)
@mfkp
mfkp / polyfills.js
Created January 15, 2013 03:12
A few helpful polyfills
// Array Remove - By John Resig (MIT Licensed)
if (!Array.prototype.remove) {
Array.prototype.remove = function (from, to) {
var rest = this.slice((to || from) + 1 || this.length);
this.length = from < 0 ? this.length + from : from;
return this.push.apply(this, rest);
};
}
if (!Array.prototype.indexOf) {
time 'git add icons; git commit -m "added icons"'
real 0m0.273s
user 0m0.032s
sys 0m0.008s
time 'svn add icons; svn commit -m "added icons"'
real 0m45.276s
user 0m15.997s
Operation Git SVN
Commit Files (A) Add, commit and push 113 modified files (2164+, 2259-) 0.64 2.60 4x
Commit Images (B) Add, commit and push 1000 1k images 1.53 24.70 16x
Diff Current Diff 187 changed files (1664+, 4859-) against last commit 0.25 1.09 4x
Diff Recent Diff against 4 commits back (269 changed/3609+,6898-) 0.25 3.99 16x
Diff Tags Diff two tags against each other (v1.9.1.0/v1.9.3.0 ) 1.17 83.57 71x
Log (50) Log of the last 50 commits (19k of output) 0.01 0.38 31x
Log (All) Log of all commits (26,056 commits - 9.4M of output) 0.52 169.20 325x
Log (File) Log of the history of a single file (array.c - 483 revs) 0.60 82.84 138x
@mfkp
mfkp / index.html
Created December 17, 2011 01:39
mailchimp ajax signup form example
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="jquery.ketchup.all.min.js" type="text/javascript"></script>
</head>
<body>
<div id="email">
<span>Enter your email to sign up</span>
<form action="/subscribe.php" id="invite" method="POST">
def techcrunch
puts "Even nerds can make great presentations!"
end
# Here's some other random code
def self.log= log
@@log = create_log log
end
def self.version
# SQLite version 3.x
# gem install sqlite3
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
Index: standardForm.php
===================================================================
--- standardForm.php (revision 1)
+++ standardForm.php (working copy)
@@ -4,7 +4,7 @@
<?php if (isset($_GET['chooser'])) {
echo '<input type="hidden" name="chooser" value="true" />';
} ?>
- <input style="width:18ex;" type="text" value="<?php echo @$_GET['q']; ?>" id="q" name="q" />
+ <input style="width:18ex;" type="text" value="<?php echo htmlspecialchars(@$_GET['q']); ?>" id="q" name="q" />
Index: UNL/Peoplefinder/Record.php
===================================================================
--- UNL/Peoplefinder/Record.php (revision 54)
+++ UNL/Peoplefinder/Record.php (working copy)
@@ -89,6 +89,7 @@
}
switch (substr($address['postal-code'],0,5)) {
case '68182':
+ case '68184':
$address['locality'] = 'Omaha';