Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Working from 🛰

Harry Moreno morenoh149

💭
Working from 🛰
View GitHub Profile
@mh-firouzjaah
mh-firouzjaah / django multiple formset add or remove
Last active Dec 22, 2020
there's not a good solution for multiple django formset instances, so I had to try mine
View django multiple formset add or remove
Hello everyone
I had tested solution for django dynamic formsets.
make it possible to add or remove formset instances.
# note: it doesn't matter that you're using djangos class based views or functional views
# note: I ignored the froms.py forms as it doesn't have effect on the procedure fo this solution.
imagine we have two models, model_A and model_B as follows:
class model_A(models.Model):
# some fields it has
@nadesh-git
nadesh-git / gist:908b9714f9c7f20b66dfb13b49ba346a
Created Jun 19, 2019
React native build issue - Androidx migration (June 2019)
View gist:908b9714f9c7f20b66dfb13b49ba346a
Reference
https://developer.android.com/jetpack/androidx/migrate
android/build.gradle:
====================
buildscript {
ext {
googlePlayServicesVersion = "16.+"
firebaseVersion = "17.3.4"
@DesignByOnyx
DesignByOnyx / postgis-geojson-liaison.js
Created Nov 9, 2018
Helpful utility for converting postgis data into GeoJSON as it comes out of the db, and vice versa.
View postgis-geojson-liaison.js
var wkx = require('wkx')
var pg = require('pg')
var pgUtil = require('pg/lib/utils')
const geoParser = {
init(knex){
// 1. Convert postgis data coming out of the db into geoJSON
// Every postgres installation will have different oids for postgis geo types.
knex
.raw('SELECT oid, typname AS name FROM pg_type WHERE typname IN (\'geography\', \'geometry\');')
@ngaller
ngaller / switchByProp.js
Last active Mar 26, 2018
transitionProps - a HOC to help build transitions with react-transition-group v2. Very nice with styled-components.
View switchByProp.js
// build a switch function that examines a key/value collection based on an object literal,
// and return the first match
//
// Example usage:
// ```
// const result = switchBy({
// entering: 'A',
// entered: 'B',
// default: 'C'
// })(props)
@jagrosh
jagrosh / Growing A Discord Server.md
Last active Oct 18, 2021
Tips for creating and growing a new Discord server
View Growing A Discord Server.md

This guide is kept up-to-date as Discord and available resources change!
A basic server template is available here

Creating and Growing a Discord Server

logo

Introduction

Hello! I'm jagrosh#4824! I'm writing this guide to try to help new server owners set up and grow their servers, which is a commonly-requested topic. It's very easy to go about this the wrong way, so it's best to be prepared and make smart decisions so that your community can flourish!

Background

@morenoh149
morenoh149 / s3_constants.py
Last active Apr 25, 2017
Demonstrate how to fill and empty an existing s3 bucket.
View s3_constants.py
S3_ACCESS_KEY = 'foo'
S3_SECRET_KEY = 'foo'
S3_BUCKET = 'foo'
@David-Guillot
David-Guillot / schemacrawler.sh
Created Mar 2, 2017
Make the SchemaCrawler shell script work from any working directory
View schemacrawler.sh
DIR=$(dirname $(readlink -f "$0"))
java -cp $(echo $DIR/lib/*.jar | tr ' ' ':'):config schemacrawler.Main "$@"
@illume
illume / image_save.py
Created Feb 12, 2017
A tool for saving files to and from a postgresql db BYTEA table.
View image_save.py
"""A tool for saving files to and from a postgresql db.
"""
import os
import sys
import argparse
import psycopg2
db_conn_str = "postgresql://username:password@localhost:5432/dbname"
create_table_stm = """
CREATE TABLE files (
@brigand
brigand / high-impact-redux-tests.md
Last active Apr 12, 2017
A guide to writing high impact redux tests.
View high-impact-redux-tests.md

Some people will tell you to test everything in your app. If you have time to kill, go for it. For most of us, we want to focus on tests that help us sleep at night. We'll be using jest in this guide, mostly because it provides snapshot testing.

mapDispatchToProps

This isn't something people normally test, but it saves us from typos that only show up in response to user interaction. Often we fail to dispatch all of the actions in our manual testing of UIs.

The premise here is simple, we want to know that all of our keys are actual functions. We'll be