Skip to content

Instantly share code, notes, and snippets.

@hirbod
hirbod / expoAnimatedWebPforIOSandAndroid.md
Last active January 10, 2024 09:11
expo-config-plugin: animated webP support for Expo SDK44+ and Custom Dev Client (with FastImage) support

I recommend to not use this anymore. Switch over to expo-image

If anybody needs animated webP support with Expo (Custom Dev Client) for the native <Image /> and <FastImage /> (read comments):

Android

// create a file like plugins/withAnimatedWebPSupport.js -> this is for the native <Image />

const {
@wosephjeber
wosephjeber / instructions.md
Last active June 27, 2024 00:35
Ecto migration for renaming table with indexes and constraints

Renaming table in Ecto migration

I recently wanted to rename a model and its postgres table in a Phoenix app. Renaming the table was simple and documented, but the table also had constraints, sequences, and indexes that needed to be updated in order for the Ecto model to be able to rely on default naming conventions. I couldn't find any examples of what this would look like but was eventually able to figure it out. For anyone else in the same situation, hopefully this example helps.

In the example below, I'm renaming the Permission model to Membership. This model belongs to a User and an Account, so it has foreign key constraints that need to be renamed.

defmodule MyApp.Repo.Migrations.RenamePermissionsToMemberships do
  use Ecto.Migration
@mohanpedala
mohanpedala / bash_strict_mode.md
Last active July 2, 2024 22:49
set -e, -u, -o, -x pipefail explanation
@mAlishera
mAlishera / ecto_migration.exs
Created January 23, 2017 22:15
Composite primary key in Ecto
defmodule Messaging.Repo.Migrations.CreateGroupChatVersions do
use Ecto.Migration
def change do
create table(:group_chat_versions, primary_key: false) do
add :group_chat_id, :uuid, primary_key: true
add :version, :integer, primary_key: true
timestamps
end

I18n with Records

Goals:

  1. Elm's typechecker enforces that
  • each localization has all the same messages.
  • the messages you are referring to in your view code exist.
  1. Only the localized strings for the current locale are sent across the wire
  2. Messages which have interpolations are typechecked as well
@pburtchaell
pburtchaell / styles.css
Last active February 25, 2024 12:24
VH and VW units can cause issues on iOS devices. To overcome this, create media queries that target the width, height, and orientation of iOS devices.
/**
* VH and VW units can cause issues on iOS devices: http://caniuse.com/#feat=viewport-units
*
* To overcome this, create media queries that target the width, height, and orientation of iOS devices.
* It isn't optimal, but there is really no other way to solve the problem. In this example, I am fixing
* the height of element `.foo` —which is a full width and height cover image.
*
* iOS Resolution Quick Reference: http://www.iosres.com/
*/
@gitaarik
gitaarik / git_submodules.md
Last active July 3, 2024 11:45
Git Submodules basic explanation

Git Submodules basic explanation

Why submodules?

In Git you can add a submodule to a repository. This is basically a repository embedded in your main repository. This can be very useful. A couple of usecases of submodules:

  • Separate big codebases into multiple repositories.
@taybenlor
taybenlor / Form Letter.md
Last active April 23, 2017 08:35
Form letter that I email to companies offering unpaid internships.

Subject: Unpaid Internships & Fair Work

Hi there,

I'm Ben Taylor, I don't represent anyone or anything, I'm simply a concerned Australian. Our country has long been known as a paradise for the working class. We give fair holidays and fair pay. We're a country that doesn't tip because we know the waitstaff are earning enough to support themselves.

I'm emailing you because your company is offering an unpaid internship. Under Australian law it's illegal to have an employee that works for free. In many cases unpaid internships are illegal.

It's absolutely in your right to offer an internship, you can pay them minimum wage if you like, but not paying is exploitative and discriminatory. Should a young person who is independent be forced to take a second job or live under severe financial stress just to get a chance in an industry? What about those who can't afford to do even that?

@h4cc
h4cc / elixir_symbols.md
Last active March 25, 2024 13:00
All symbols used in the elixir programming language

Symbols used in Elixir

A list of all not symbols and notations of elixir. Tried to have a base for comparision for other programming languages.

Operators

  • === (strict)
  • !== (strict)
  • == (relaxed)
@jedi4ever
jedi4ever / nodejs-cluster-zero-downtime.md
Last active June 29, 2024 16:00
nodejs clustering, zero downtime deployment solutions

Clustering: The basics

The trick? pass the file descriptor from a parent process and have the server.listen reuse that descriptor. So multiprocess in their own memory space (but with ENV shared usually)

It does not balance, it leaves it to the kernel.

In the last nodejs > 0.8 there is a cluster module (functional although marked experimental)