Skip to content

Instantly share code, notes, and snippets.

View catogonzalez's full-sized avatar

Carlos Gonzalez catogonzalez

  • Bogota, Colombia
View GitHub Profile
@mfehrenbach
mfehrenbach / chrome-device-dimensions.md
Last active July 13, 2024 18:31
Modern device dimensions for Chrome DevTools.

Modern Device Dimensions for Chrome DevTools

These are modern “Emulated Devices” (a.k.a. responsive dimensions) for Chrome DevTools’ Mobile Device Viewport Mode.

They are specifically Apple devices, subtracting for recent Safari UI (as in window.innerWidth/Height), and cleverly sorted with some dark-arts unicode shenanigans. (This glitchy, unloved portion of the tools sorts lexicographically, because of course it would.) Ergonomics!

before-after

Nest Hub Max? Come on. I dropped a bunch of devices that were older and/or close to these dimensions. It obviously doesn’t cover everything (sorry Android/Chrome), but offers a decent spread/increments for common 2023/2024 viewports.

@catogonzalez
catogonzalez / Rails Console time travel
Created March 2, 2022 19:17 — forked from signaes/Rails Console time travel
Using active support time helpers to change the current date in the rails console
require 'active_support/testing/time_helpers'
# the class below could have any name
class Tempo
include ActiveSupport::Testing::TimeHelpers
end
# any desidered date
desired_date = Date.today - 2.days
@devrishik
devrishik / PostgreSQL JSON Indexing and Django Models references
Last active January 10, 2024 17:36
A quick cook book to Postgres indexes and Django model references
Django provides references to all of the existing indexes in Postgres.
Django managers can be used for managing indexes dynamically, a handle
can be provided as IndexManager to extend for custom querysets or raw sql queries.
PostGres
--------
Types of indexes: https://www.postgresql.org/docs/9.1/indexes-types.html
BRIN: Block Range Index: good for comparing blocks with relative location data
Btree (default): @> <> =:
@siddolo
siddolo / bettercap.md
Last active April 7, 2024 15:55
bettercap webui from docker

bettercap webui from docker

create volume

docker volume create bettercap

bootstrap/update

Only run caplets.update the first time as every time the entire system caplets folder is replaced with the downloaded contents from github, overwriting your changes, such as the credentials, with default values. You can either backup your changes and restore them later in the system folder, or simply copy the changed caplet files in bettercap’s working directory, in which case they’ll be loaded before the ones installed system wide. https://www.bettercap.org/usage/

@signaes
signaes / Rails Console time travel
Created February 18, 2020 22:29
Using active support time helpers to change the current date in the rails console
require 'active_support/testing/time_helpers'
# the class below could have any name
class Tempo
include ActiveSupport::Testing::TimeHelpers
end
# any desidered date
desired_date = Date.today - 2.days
@ziaulrehman40
ziaulrehman40 / postgres app multiple versions.md
Last active March 28, 2023 14:00
Using multiple postgresql version with appropoiate psql and other pg tools version on mac with postgresapp

Using multiple postgresql version with appropoiate psql and other pg tools version on mac with postgresapp

First make sure no postgres instance is configured to run on startup. And you get nothing when you run this command: which -a psql This is to make sure you don't have anything related to postgres in your PATH, which can conflict. If you do get some hits with above command, you have to manually either remove the installed versions of postgres or just fix PATH and remove ref to that path which has these binaries(psql, pg_dump etc)

For me, i was using brew installed postgres, i had to just comment out a PATH editing line which was inserted by brew in my .bash_profile

Ok, after this we are ready. Now things are simple:

@ryenski
ryenski / hello.vue
Last active April 27, 2023 03:04
Stimulus.js + Vue.js
<template>
<div id="app">
<p>{{ message }}</p>
</div>
</template>
<script>
export default {
data: function () {
return {
@majackson
majackson / migrations.md
Last active July 22, 2024 16:29
Django migrations without downtime

Django Migrations without Downtime

The following instructions describe a set of processes allowing you to run Django database migrations against a production database without having to bring the web service down.

Note that in the below instructions, migrations are all run manually at explicit points, and are not an automatic part of the deployment process.

Adding Fields or Tables

Adding a (nullable) field or a new table

  1. Make the model or column addition in your code.
@neuni
neuni / openvpn_on_google_cloud.md
Created February 28, 2017 13:34
Create a openVPN server on Google Cloud Platform to connect to your Google Cloud network using openVPN and/or to route your internet traffic through the VPN (Road Warrior Scenario)

Install openVPN server on Google Cloud using Pritunl

Purpose:

Create a openVPN server on Google Cloud Platform to connect to your Google Cloud network using openVPN and/or to route your internet traffic through the VPN (Road Warrior Scenario)

Create instance

  • Create new instance in default network
  • Chosse Ubuntu 16.04 LTS
@randallreedjr
randallreedjr / heroku-remote.md
Last active April 25, 2024 07:06
Add a Heroku remote to an existing git repo

Working with git remotes on Heroku

Generally, you will add a git remote for your Heroku app during the Heroku app creation process, i.e. heroku create. However, if you are working on an existing app and want to add git remotes to enable manual deploys, the following commands may be useful.

Adding a new remote

Add a remote for your Staging app and deploy

Note that on Heroku, you must always use master as the destination branch on the remote. If you want to deploy a different branch, you can use the syntax local_branch:destination_branch seen below (in this example, we push the local staging branch to the master branch on heroku.

$ git remote add staging https://git.heroku.com/staging-app.git