Skip to content

Instantly share code, notes, and snippets.

@stinoga
stinoga / terminal
Created August 1, 2012 01:58
Saving SSH keys on Mac
# Run this in terminal to generate a key on your local machine
ssh-keygen -t rsa
# Next, SSH into your site and and copy the contents of the local file ~/.ssh/mykey.pub to the remote file ~/.ssh/authorized_keys
# I use vi for this, and you can have multiple keys in one file
@stinoga
stinoga / .htaccess
Created May 18, 2012 03:16
Wordpress SEO friendly search rewrite rule
# search redirect
# this will take anything in the query string, minus any extraneous values, and turn them into a clean working url
RewriteCond %{QUERY_STRING} \\?s=([^&]+) [NC]
RewriteRule ^$ /search/%1/? [NC,R,L]
@stinoga
stinoga / SQL Query to create table
Created April 22, 2012 03:35
Jquery Ajax Email Signup Form in Wordpress
CREATE TABLE `mailinglist` ( `id` INT NOT NULL AUTO_INCREMENT , `email` TEXT NOT NULL, `user` TEXT NOT NULL , PRIMARY KEY ( `id` ) )
@stinoga
stinoga / list.py
Created October 1, 2015 22:01
List Arguments in Python
import inspect
def func(a, b, c):
frame = inspect.currentframe()
args, _, _, values = inspect.getargvalues(frame)
print 'function name "%s"' % inspect.getframeinfo(frame)[2]
for i in args:
print " %s = %s" % (i, values[i])
return [(i, values[i]) for i in args]
@stinoga
stinoga / console.js
Last active August 29, 2015 13:57
Get Titles on the Page (jQuery)
var jq = document.createElement('script');
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
jQuery.noConflict();
var array = []
$(".title > a").each(function() {
array.push($(this).text());
});