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 July 5, 2024 03:58
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 June 25, 2024 13:44
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()
@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];