A (more) complete cheatsheet for Arel, including NamedFunction functions, raw SQL and window functions.
posts = Arel::Table.new(:posts)
posts = Post.arel_table # ActiveRecord
graphdeps
produces "deps.png" in the working directory. Just graphdeps
will graph all tasks. You can change the default behavior by specifying a more specific query.
NOTE: This guide has moved to https://github.com/bpierre/switch-to-vim-for-good
This guide is coming from an email I used to send to newcomers to Vim. It is not intended to be a complete guide, it is about how I switched myself.
My decision to switch to Vim has been made a long time ago. Coming from TextMate 1, I wanted to learn an editor that is Open Source (so I don’t lose my time learning a tool that can be killed), cross platform (so I can use it everywhere), and powerful enough (so I won’t regret TextMate). For these reasons, Vim has always been the editor I wanted to learn, but it took me several years before I did it in a way that works for me. I tried to switch progressively, using the Janus Vim distribution for a few months, then got back to using TextMate 2 for a time, waiting for the next attempt… here is what finally worked for me.
Original gist with comments: https://gist.github.com/bpierre/0a0025d348b6001394e0
The MIT-except-Apple License (MIT-EA) | |
Copyright (c) <year> <copyright holders> | |
Permission is hereby granted, free of charge, to any person (except | |
anybody associated with Apple Inc.) obtaining a copy of this software | |
and associated documentation files (the "Software"), to deal in the | |
Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is |
This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.
The script is here:
#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"
import tornado | |
class RequestContextHandler(tornado.web.RequestHandler): | |
def _execute(self, transforms, *args, **kwargs): | |
# following the example of: | |
# https://github.com/bdarnell/tornado_tracing/blob/master/tornado_tracing/recording.py | |
global_data = {} # add whatever here, e.g. self.request |
#! /bin/sh | |
# Refactored from Ubuntu's hdparm script | |
# It isn't safe to set an APM policy by default on Firewire or USB devices. | |
# See https://bugs.launchpad.net/bugs/515023. | |
has_apm() | |
{ | |
hdparm -i $dev 2> /dev/null | grep -q 'AdvancedPM=yes' | |
} |
##How Homakov hacked GitHub and the line of code that could have prevented it
Please note: THIS ARTICLE IS NOT WRITTEN BY THE GITHUB TEAM or in any way associated with them. It's simply hosted as a Gist because the markdown formatting is excellent and far clearer than anything I could manage on my personal Tumblr at peternixey.com.
If you'd like to follow me on twitter my handle is @peternixey
" Unmap these silly J,K | |
unmap J | |
unmap K | |
map <C-h> previousTab | |
map <C-l> nextTab | |
" Cyrillic shortcuts | |
map гг scrollToTop | |
map Г scrollToBottom |