Skip to content

Instantly share code, notes, and snippets.

View srt32's full-sized avatar
πŸ’­
wahoo

Simon Taranto srt32

πŸ’­
wahoo
  • GitHub
  • WORLD
  • 11:19 (UTC -04:00)
View GitHub Profile
@srt32
srt32 / install.md
Last active July 18, 2021 23:43
installing PostGIS on OSX

Installing the Postgres PostGIS extension on OSX

For reference: http://postgis.net/install

If you don’t already have PG installed

The most reliable way to get PostGIS on OSX is to download and install Postgres.app. Great for development and testing. Do not mix with other installations. Select the extension when prompted.

If you already have PG installed

class SearchesController < ApplicationController
def index
@tools = Tool.search do
keywords params[:query]
end.results
@inventories = Inventory.search do
keywords params[:query]
end.results
@srt32
srt32 / gist:04b27dde11f99f68a3bf
Created September 10, 2014 15:35
golang: ambiguous selector when embedding structs with conflicting method names
package main
func main() {
>> car{}.Model()
}
type car struct {
vehicle
boat
}
// original
function updateImage(){
square_urls.map(function(urls){
urls.map(function(u){
console.log(u);
});
});
}
@srt32
srt32 / migration
Created September 26, 2014 17:04
welcome-wagon create table
CREATE TABLE IF NOT EXISTS users (
email varchar PRIMARY KEY NOT NULL,
started_on date NOT NULL
);
CREATE UNIQUE INDEX users_email_index ON users (email);
require 'minitest'
require 'minitest/autorun'
class ReduceTest < Minitest::Test
def test_capitalize_keywords_in_phrase_one_fish_two_fish_red_fish_blue_fish
keywords = ["fish", "blue"]
phrase = 'one fish two fish red fish blue fish'
result = phrase.split.reduce do |updatedPhrase, word|
new_word = word
@srt32
srt32 / circleci.yml
Created June 15, 2017 16:35
Building and Deploying Docker Images to Heroku via CircleCI
machine:
services:
- docker
dependencies:
override:
- echo "no deps"
test:
post:
@srt32
srt32 / honeybadger_parser.rb
Last active November 8, 2022 19:56
parse the JSONL export from honeybadger.io
# usage: cat ~/Downloads/log_foo-bar-baz.jsonl | ruby honeybadger_parser.rb
require 'json'
data = ARGF.read
lines = data.split("\n")
grouped = lines.group_by do |line|
JSON.parse(line)["request"]["context"]["project_id"]
end
@srt32
srt32 / application.rb
Created May 17, 2018 22:23
logging current user.id in Rails logs
config.log_tags = [
:request_id,
:subdomain,
->(req) {
session_key = (Rails.application.config.session_options || {})[:key]
session_data = req.cookie_jar.encrypted[session_key] || {}
user_id = session_data["user_id"] || "guest"
"user: #{user_id.to_s}"
}
]
@srt32
srt32 / query.graphql
Last active October 2, 2018 02:56
find recently changed issues / PR's - https://developer.github.com/v4/explorer/
{
viewer {
pullRequests(first: 10, orderBy: {field: UPDATED_AT, direction: DESC}) {
nodes {
title
closedAt
url
}
}
issues(first: 10, orderBy: {field: UPDATED_AT, direction: DESC}) {