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
@boyd
boyd / check_internet.py
Created October 22, 2012 03:27
Script for monitoring internet
import datetime
import time
import urllib2
def log(s, ts=None):
ts = datetime.datetime.now()
print ts.strftime("%H:%M:%S ") + s
def main():
last_state_change = time.time()
@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>
@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;
@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) {
@jagrosh
jagrosh / Github Webhook Tutorial.md
Last active November 18, 2024 08:23
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
@ravibhure
ravibhure / git_rebase.md
Last active November 9, 2024 05:19
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

@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({
@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: {
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()
@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