Convert Ruby 1.8 hash syntax into 1.9 syntax in vim
E.g. :key => 'value'
will become key: 'value'
:%s/:(\S+) =>/\1:/g
Convert Ruby 1.8 hash syntax into 1.9 syntax in vim
E.g. :key => 'value'
will become key: 'value'
:%s/:(\S+) =>/\1:/g
<html> | |
<head> | |
<style type="text/css"> | |
html, body, .container {width: 100%; height: 100%;} | |
.container {display: -webkit-box; -webkit-box-orient: vertical; -webkit-box-align: stretch; -webkit-box-pack: start;} | |
.container div {-webkit-box-flex: 1;} | |
</style> | |
</head> | |
<body style="width: 100%;height: 100%;"> | |
<div class="container"> |
// Do whatever you'd like with the script! Show it off, mod it up, post it places, or whatever. :) | |
// (If you do, I wouldn't mind a Twitter shoutout at @_slinehan when appropriate!) | |
$imageURL = "URL HERE"; | |
$image = imagecreatefromjpeg($imageURL); | |
$width = imagesx($image); | |
$height = imagesy($image); | |
// First, let's resize the image to something manageable while maintaining aspect ratio. |
<dl class="tabs pill"> | |
<dd class="active"><a href="#pillTab1">Hotel Info</a></dd> | |
<dd><a href="#pillTab2">Marriott Courtyard</a></dd> | |
<dd><a href="#pillTab3">Homewood Suites</a></dd> | |
</dl> | |
<ul class="tabsContent"> | |
<li id="pillTab1Tab" class="active"> | |
Stuff |
a = Ember.A()
a.pushObject(1);
a.pushObject(2);
a.slice(-1);
// [1]
ul {
padding:0;
display:table;
width:100%;
background-color:red;
}
li {
display: table-cell;
text-align: center;
# don't serialize comment and category records because we'll embed them into the post.
App.Adapter = DS.RESTAdapter.extend
dirtyRecordsForBelongsToChange: (dirtySet, child, relationship) ->
return undefined if [App.Comment, App.Category].contains child.constructor
dirtySet.add(child)
dirtyRecordsForHasManyChange: (dirtySet, parent, relationship) ->
if parent.constructor == App.Post
return undefined if ["categories", "comments"].comtains relationships.hasManyName
python
in terminal. If it opens a python shell, you're good to go.easy_install pip
works on OSX. This should add symlinks and add the executable to $PATH also. Technically you don't need to install pip
though because every virtualenv
environment comes with pip
. It's easier to install virtualenv
with pip
though. Haven't tried easy_install virtualenv
.pip install virtualenv
. You may need to add the install directory to $PATH.google_appengine
directory to the $PYTHONPATH environment variable.I can never get Rails to connect to the Postgres server in development. I'll write a fuller tutorial that explains things better later, but I can explain some really basic things first.
The issue is that osx is looking for the server socket in a default location and postgres is putting the client in a default location. Those locations are not the same.
Postgres puts the socket in /var/pgsql_socket
. Or at least that is where mine is at the moment. This is configurable in a postgres.conf
file. You can do a global search for this file in terminal by running sudo find / -name postgres.conf
. In that file look for the line that says unix_socket_directory
. You could probably edit that and tell postgres to put the socket somewhere else, but more on that later.
The client, in this case Rails, needs to know where to look for the socket. When I started my Rails server, it would crash saying it couldn't find the socket file in /tmp/.s.PGSQL.5432
. So now at least I know where Rails is looking by default. I