Skip to content

Instantly share code, notes, and snippets.

View emerak's full-sized avatar
🏠
Working from home

Alejandra Cernas emerak

🏠
Working from home
View GitHub Profile
@mankind
mankind / rails-jsonb-queries
Last active April 17, 2024 12:14
Ruby on Rails-5 postgresql-9.6 jsonb queries
http://stackoverflow.com/questions/22667401/postgres-json-data-type-rails-query
http://stackoverflow.com/questions/40702813/query-on-postgres-json-array-field-in-rails
#payload: [{"kind"=>"person"}]
Segment.where("payload @> ?", [{kind: "person"}].to_json)
#data: {"interest"=>["music", "movies", "programming"]}
Segment.where("data @> ?", {"interest": ["music", "movies", "programming"]}.to_json)
Segment.where("data #>> '{interest, 1}' = 'movies' ")
Segment.where("jsonb_array_length(data->'interest') > 1")
@octocat
octocat / .gitignore
Created February 27, 2014 19:38
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
Ahhhhhhhhh
Ya ya yaaaah
Ya ya yaaah
Yaaah ya yah
Ohohohohoooo
Oh ya yaaah
Ya ya yaaah
Yaaah ya yah
@pyk
pyk / installing postgresql 9.3.2 on ubuntu 12.04.md
Created January 3, 2014 18:05
installing postgresql 9.3.2 on ubuntu 12.04 . with error fix: ummet dependencies

installing postgresql 9.3.2 on ubuntu 12.04

$ echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" > /etc/apt/sources.list.d/pgdg.list
$ wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
$ sudo apt-get update
$ sudo apt-get install postgresql-9.3 postgresql-contrib-9.3

you should succesfully installing postgresql 9.3.2 on your machine.

@branneman
branneman / better-nodejs-require-paths.md
Last active April 27, 2024 04:16
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@adilsoncarvalho
adilsoncarvalho / install-postgresql-9.3.sh
Last active December 31, 2015 04:09
Installing Postgresql-9.3 on Ubuntu (10.04 or 12.04)
#!/bin/bash
#
# As seen at http://www.postgresql.org/download/linux/ubuntu/
#
REPO_FILE=/etc/apt/sources.list.d/pgdg.list
UBUNTU_VERSION=$(lsb_release -sr)
if [[ $UBUNTU_VERSION -eq '12.04' ]]; then
@facultymatt
facultymatt / roles_invesitgation.md
Last active April 16, 2024 09:31
Roles and permissions system for Nodejs
@laacz
laacz / nearest-road.sql
Created May 19, 2012 08:19
PostGIS: Find nearest roads (represented by linestring) to a given point
/*
* Road data comes from OpenStreetmap (http://download.geofabrik.de/osm/)
**/
select st_distance(st_closestpoint(r.the_geog::geometry, wa.location::geometry), wa.location::geometry) as cp
, r.name
, r.ref
, r.ogc_fid
, r.type
, st_astext(wa.location)
, wa.*
Hi David,
I came across your profile online and wanted to reach out about Development
Opportunities here at Groupon. The company is growing, and we're always
looking for folks with solid skills that can make positive contribution to
our continued success. Any chance you'd be open to a quick conversation
about opportunities, or for any possible networking potential? If so, let me
know when you're free and we can set up a time to chat. Also, if you are
interested, it would be great if you could forward a current resume over
that I can take a look at. I look forward to hearing back from you! Please
let me know if you have any questions.