Skip to content

Instantly share code, notes, and snippets.

View agodin3z's full-sized avatar
🍻
Working hard~

Andrés Godínez agodin3z

🍻
Working hard~
View GitHub Profile
@nurycaroline
nurycaroline / sequelize-migration-file-generator.js
Last active June 18, 2021 20:53 — forked from agodin3z/sequelize-migration-file-generator.js
Creates migration files for existing sequelize models [custom]
#!/usr/bin/env node
const fs = require("fs");
const path = require("path");
const models = require("./src/api/models");
for (const model in models) {
const { tableName } = models[model];
@ManuelVillegas96
ManuelVillegas96 / ElSalvador-Departments-Municipalities-ZipCode.json
Last active July 17, 2024 17:22
El Salvador json with Departments, Municipalities and Zip Codes
[
{ "state": "Ahuachapán", "city": "Ahuachapán", "zip": "2101" , "title": "Ciudad Cabecera" , "district": "Ahuachapán", "municipality": "Ahuachapán Centro"},
{ "state": "Ahuachapán", "city": "Apaneca", "zip": "2102" , "title": "Villa" , "district": "Ahuachapán", "municipality": "Ahuachapán Centro" },
{ "state": "Ahuachapán", "city": "Atiquizaya", "zip": "2103" , "title": "Ciudad" , "district": "Atiquizaya", "municipality": "Ahuachapán Norte" },
{ "state": "Ahuachapán", "city": "Concepción de Ataco", "zip": "2106" , "title": "Ciudad" , "district": "Ahuachapán", "municipality": "Ahuachapán Centro" },
{ "state": "Ahuachapán", "city": "El Refugio" , "zip": "2107", "title": "Pueblo" , "district": "Atiquizaya", "municipality": "Ahuachapán Norte" },
{ "state": "Ahuachapán", "city": "Guaymango" , "zip": "2108", "title": "Pueblo" , "district": "Ahuachapán", "municipality": "Ahuachapán Sur" },
{ "state": "Ahuachapán", "city": "Jujutla" , "zip": "2109", "title": "Villa" , "district": "Ahuacha
import { Connection, EntitySubscriberInterface, getMetadataArgsStorage, Repository, UpdateEvent } from 'typeorm';
import { Injectable } from '@nestjs/common';
import { InjectConnection, InjectRepository } from '@nestjs/typeorm';
import { updatedDiff } from 'deep-object-diff';
import { AuditTrailEntity } from '../entities/AuditTrailEntity';
import { AuditTrailValueEntity } from '../entities/AuditTrailValueEntity';
import { AuditHistoryToAuditTrailEntity } from '../entities/AuditHistoryToAuditTrailEntity';
import { AuditHistoryEntity } from '../entities/AuditHistoryEntity';
@Injectable()
@tlumko
tlumko / audit-log.js
Created August 27, 2018 13:06
Node sequelize audit log
const AuditLog = auditLogDb.define('audit-log', {
userId: {
type: Sequelize.DataTypes.INTEGER,
allowNull: true,
},
actionType: {
type: Sequelize.DataTypes.STRING,
allowNull: false,
},
table: {
@smontlouis
smontlouis / Component.js
Last active September 11, 2022 11:13
React Native - Fixed header/footer disappearing on scroll
import React, { PropTypes, Component } from 'react'
import {
Animated,
ScrollView,
Text,
View,
} from 'react-native'
import EStyleSheet from 'react-native-extended-stylesheet'
const styles = EStyleSheet.create({
@ravibhure
ravibhure / git_rebase.md
Last active July 26, 2024 08:21
Git rebase from remote fork repo

In your local clone of your forked repository, you can add the original GitHub repository as a "remote". ("Remotes" are like nicknames for the URLs of repositories - origin is one, for example.) Then you can fetch all the branches from that upstream repository, and rebase your work to continue working on the upstream version. In terms of commands that might look like:

Add the remote, call it "upstream":

git remote add upstream https://github.com/whoever/whatever.git

Fetch all the branches of that remote into remote-tracking branches, such as upstream/master:

git fetch upstream

@jagrosh
jagrosh / Github Webhook Tutorial.md
Last active July 23, 2024 22:30
Simple Github -> Discord webhook

Step 1 - Make a Discord Webhook

  1. Find the Discord channel in which you would like to send commits and other updates

  2. In the settings for that channel, find the Webhooks option and create a new webhook. Note: Do NOT give this URL out to the public. Anyone or service can post messages to this channel, without even needing to be in the server. Keep it safe! WebhookDiscord

Step 2 - Set up the webhook on Github

  1. Navigate to your repository on Github, and open the Settings Settings
@jscari
jscari / Luhn.js
Last active November 17, 2020 02:27
Luhn algorithm - generate / validate
var Luhn = {
// length of our number (check digit included)
length: 10,
pow2: [0, 2, 4, 6, 8, 1, 3, 5, 7, 9],
// compute check digit
checksum: function (x) {
var sum = 0;
var n;
var odd = false;
for (var i = x.length - 1; i >= 0; --i) {
@manuelbieh
manuelbieh / sequelize-migration-file-generator.js
Created January 14, 2016 16:42
Creates migration files for existing sequelize models
import * as models from "models";
import fs from "fs";
for(let model in models) {
let attributes = models[model].attributes;
for(let column in attributes) {
delete attributes[column].Model;
delete attributes[column].fieldName;
@carloscarcamo
carloscarcamo / form-error.html
Created December 14, 2015 22:18
Show angular form errors
<tt>reviewForm.$valid = {{ 'reviewForm.$valid' }}</tt>
<ul>
<li ng-repeat="(key, errors) in reviewForm.$error track by $index"> <strong>{{ 'key' }}</strong> errors
<ul>
<li ng-repeat="e in errors">{{ e.$name }} has an error: <strong>{{ key }}</strong>.</li>
</ul>
</li>
</ul>