Skip to content

Instantly share code, notes, and snippets.

View abelmartin's full-sized avatar
😅

Abel Martin abelmartin

😅
  • Rhino
  • Washington, DC
View GitHub Profile
@steida
steida / gist:b975439378980911ee4d
Last active March 20, 2018 15:37
I love Coffee React with dependency injection.
goog.provide 'app.react.App'
class app.react.App
###*
@param {app.Routes} routes
@param {app.react.Header} header
@param {app.react.Footer} footer
@param {app.react.pages.Home} home
@param {app.react.pages.EditSong} editSong
@dmilisic
dmilisic / active_record_enum_with_rails_admin.rb
Last active January 21, 2022 10:50
Initializer for handling ActiveRecord (4.1+) enums by RailsAdmin (0.6.2)
module ActiveRecord
module RailsAdminEnum
def enum(definitions)
super
definitions.each do |name, values|
define_method("#{ name }_enum") { self.class.send(name.to_s.pluralize).to_a }
define_method("#{ name }=") do |value|
if value.kind_of?(String) and value.to_i.to_s == value
@Kartones
Kartones / postgres-cheatsheet.md
Last active June 13, 2024 20:14
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@lfender6445
lfender6445 / gist:9919357
Last active May 12, 2024 19:09
Pry Cheat Sheet

Pry Cheat Sheet

Command Line

  • pry -r ./config/app_init_file.rb - load your app into a pry session (look at the file loaded by config.ru)
  • pry -r ./config/environment.rb - load your rails into a pry session

Debugger

@jbenet
jbenet / simple-git-branching-model.md
Last active June 14, 2024 17:16
a simple git branching model

a simple git branching model (written in 2013)

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

Update: Woah, thanks for all the attention. Didn't expect this simple rant to get popular.

@craigcalef
craigcalef / gist:6403297
Created September 1, 2013 09:28
Access the EVE Online CREST API to obtain information on Dust 514 Planetary Conquest districts and produce reports of various useful information.
import requests, json
from collections import Counter
districts = json.loads(requests.get('http://public-crest.eveonline.com/districts/').text)['items']
systems = {}
constellations = {}
s_times = {}
c_times = {}
class Mammal
constructor: (@name) ->
class Kitty extends Mammal
sayHello: -> "Meow! My name is: #{@name}"
class Purrpy extends Mammal
sayHello: -> "Woof! My name is: #{@name}"
leopold = new Kitty("Leopold")
@jordelver
jordelver / gist:5617879
Last active December 19, 2017 05:36
Spell check entire codebase

Spell check entire codebase

Requires aspell. Install using brew install aspell on Mac OS X.

From STDIN

cat *.txt | aspell -l EN-US --mode=tex list

Whole directory

<html>
<head>
<style type="text/css">
.center {
text-align: center;
}
@-webkit-keyframes blink {
from { opacity: 1.0; }
to { opacity: 0.0; }
@rmw
rmw / application_controller_mobile_only.rb
Last active December 14, 2015 11:59
Using mobile_fu
class ApplicationController < ActionController::Base
protect_from_forgery
has_mobile_fu false
protected
def mobile_only_mobile_fu
set_mobile_format if is_mobile_device?
end
end