I always forget all the different ways of serializing associations things, so putting down notes:
class AuthorSerializer < ActiveModel::Serializer
has_many :posts
emd
### Keybase proof | |
I hereby claim: | |
* I am mehulkar on github. | |
* I am mehulkar (https://keybase.io/mehulkar) on keybase. | |
* I have a public key whose fingerprint is 0124 35B0 BA24 1473 594F 5712 8565 B49E 13F9 BF48 | |
To claim this, I am signing this object: |
# Inspired by @mrmrs http://designbytyping.com/2014/10/17/cloning-repos/ | |
user="mehulkar" | |
# curl the pages directly instead of saving | |
# the urls to a txt file first | |
for page in {1..3}; do | |
curl "https://api.github.com/users/$user/repos?page=$page&per_page=100" >> repos.json | |
done |
#!/usr/bin/env bash | |
# Add this file to .git/hooks/pre-commit | |
# and make it executable. | |
# 1. greps the repo for "focus: true" | |
# 2. counts number of results | |
# 3. Strips the whitespace from the resulting number string | |
num=$(git grep "focus: true" | wc -l | xargs) |
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;