Skip to content

Instantly share code, notes, and snippets.

View full-of-foo's full-sized avatar
💭
I'm currently working 150% of the time as a manager. No code 👎

Toeknee full-of-foo

💭
I'm currently working 150% of the time as a manager. No code 👎
View GitHub Profile
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active May 2, 2024 22:20
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@varyonic
varyonic / Dockerfile
Created June 10, 2016 14:14
Dockerfile with chromedriver
# See https://codeship.com/documentation/docker/browser-testing/
FROM myapp:base
# We need wget to set up the PPA and xvfb to have a virtual screen and unzip to install the Chromedriver
RUN apt-get install -y wget xvfb unzip
# Set up the Chrome PPA
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
RUN echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list
@robertpainsi
robertpainsi / commit-message-guidelines.md
Last active May 1, 2024 16:04
Commit message guidelines

Commit Message Guidelines

Short (72 chars or less) summary

More detailed explanatory text. Wrap it to 72 characters. The blank
line separating the summary from the body is critical (unless you omit
the body entirely).

Write your commit message in the imperative: "Fix bug" and not "Fixed
bug" or "Fixes bug." This convention matches up with commit messages
@HelioCampos
HelioCampos / database_migration_best_practices.md
Created September 28, 2017 14:00
Database migration best practices for Rails

Database migration best practices for Rails

Never ever change data on schema changes! [1]

Use rake tasks to change the data! [1]

This decouples a deployment from completed migrations. Give us control of the data manipulation proccess by encapsulatin it in on place. need to remember to:

  1. Run it in one of the ways bellow: a. Add this rake task the deployment script or;
@rain-1
rain-1 / GPT-4 Reverse Turing Test.md
Last active April 16, 2024 23:19
GPT-4 Reverse Turing Test

The reverse turing test

I asked GPT-4 to come up with 10 questions to determine if the answerer was AI or human.

I provided my own answers for these questions and I also asked ChatGPT to answer them.

The result is that GPT-4 was able to correctly differentiate between AI and Human.

@edisonywh
edisonywh / pre-commit
Last active April 15, 2024 22:58
Run Rubocop in Git's pre-commit hook
```
#!/bin/sh
echo "\nRunning rubocop 🚓 💨 💨 💨\n"
declare -a ERRORS=()
for file in $(git diff --cached --name-only | grep -E '.rb')
do
ERRORS+=("$(rubocop $file | grep -e 'C:' -e 'E:')")
done

Status

This extension was developed as part of the jsonapi module for Drupal.

Introduction

The JSON API specification is agnostic about how a server implements filtering strategies. In fact, the spec says:

Note: JSON API is agnostic about the strategies supported by a server. The filter query parameter can be used as the basis for any number of filtering strategies.

@zenorocha
zenorocha / README.md
Last active April 6, 2024 16:59
A template for Github READMEs (Markdown) + Sublime Snippet

Project Name

TODO: Write a project description

Installation

TODO: Describe the installation process

Usage

@hopsoft
hopsoft / db.rake
Last active April 3, 2024 13:13
Rails rake tasks for dump & restore of PostgreSQL databases
# lib/tasks/db.rake
namespace :db do
desc "Dumps the database to db/APP_NAME.dump"
task :dump => :environment do
cmd = nil
with_config do |app, host, db, user|
cmd = "pg_dump --host #{host} --username #{user} --verbose --clean --no-owner --no-acl --format=c #{db} > #{Rails.root}/db/#{app}.dump"
end
puts cmd
// XPath CheatSheet
// To test XPath in your Chrome Debugger: $x('/html/body')
// http://www.jittuu.com/2012/2/14/Testing-XPath-In-Chrome/
// 0. XPath Examples.
// More: http://xpath.alephzarro.com/content/cheatsheet.html
'//hr[@class="edge" and position()=1]' // every first hr of 'edge' class