Skip to content

Instantly share code, notes, and snippets.

View zealoushacker's full-sized avatar

Alex Notov zealoushacker

View GitHub Profile
@zealoushacker
zealoushacker / GPG and git on macOS.md
Created March 9, 2017 17:29 — forked from danieleggert/GPG and git on macOS.md
How to set up git to use the GPG Suite

GPG and git on macOS

Setup

No need for homebrew or anything like that. Works with https://www.git-tower.com and the command line.

  1. Install https://gpgtools.org -- I'd suggest to do a customized install and deselect GPGMail.
  2. Create or import a key -- see below for https://keybase.io
  3. Run gpg --list-secret-keys and look for sec, use the key ID for the next step
  4. Configure git to use GPG -- replace the key with the one from gpg --list-secret-keys

#Four Ways To Do Pub/Sub With jQuery and jQuery UI (in the future)

Between jQuery 1.7 and some of work going into future versions of jQuery UI, there are a ton of hot new ways for you to get your publish/subscribe on. Here are just four of them, three of which are new.

(PS: If you're unfamiliar with pub/sub, read the guide to it that Julian Aubourg and I wrote here http://msdn.microsoft.com/en-us/scriptjunkie/hh201955.aspx)

##Option 1: Using jQuery 1.7's $.Callbacks() feature:

$.Callbacks are a multi-purpose callbacks list object which can be used as a base layer to build new functionality including simple publish/subscribe systems. We haven't yet released the API documentation for this feature just yet, but for more information on it (including lots of examples), see my post on $.Callbacks() here:

Steps to install and run PostgreSQL 9.2 using Homebrew (Mac OS X)
(if you aren't using version 9.1.5, change line 6 with the correct version)
1. launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
2. mv /usr/local/var/postgres /usr/local/var/postgres91
3. brew update
4. brew upgrade postgresql
5. initdb /usr/local/var/postgres -E utf8
6. pg_upgrade -b /usr/local/Cellar/postgresql/9.1.5/bin -B /usr/local/Cellar/postgresql/9.2.0/bin -d /usr/local/var/postgres91 -D /usr/local/var/postgres
7. cp /usr/local/Cellar/postgresql/9.2.0/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/

##Goals 01/07/2014

###git and github

  • Understand the purpose of version control systems
  • Learn how to manage files/projects with git and github
  • Understand git branching
  • Understand how to collaborate with others

###file i/o, arrays, hashes

@zealoushacker
zealoushacker / gist:1705801
Created January 30, 2012 18:25 — forked from davist11/gist:1204569
Campfire sounds
crickets: "hears crickets chirping"
drama: "https://123.campfirenow.com/images/drama.jpg"
greatjob: "https://123.campfirenow.com/images/greatjob.png"
live: "is DOING IT LIVE"
nyan: "https://123.campfirenow.com/images/nyan.gif"
ohmy: "raises an eyebrow :smirk:"
pushit: "https://123.campfirenow.com/images/pushit.gif"
rimshot: "plays a rimshot"
secret: "found a secret area :key:"
tada: "plays a fanfare :flags:"
# Allow RSpec assertions over the elements of a collection. For example:
#
# collection.should all_be > 0
#
# will specify that each element of the collection should be greater
# than zero. Each element of the collection that fails the test will
# be reported in the error message.
#
# Examples:
# [1,1,1].should all_be eq(1)
<!DOCTYPE html>
<html>
<head>
<title>Site</title>
</head>
<body class="app">
<%= render :partial => 'layouts/flashes' %>
<%= yield %>
</body>
</html>
@zealoushacker
zealoushacker / gist:1016312
Created June 9, 2011 08:20 — forked from dhh/gist:1014971
Use concerns to keep your models manageable
# autoload concerns
module YourApp
class Application < Rails::Application
config.autoload_paths += %W(
#{config.root}/app/controllers/concerns
#{config.root}/app/models/concerns
)
end
end