Skip to content

Instantly share code, notes, and snippets.

View vampaynani's full-sized avatar
🏠
Working from home

Wenceslao Negrete vampaynani

🏠
Working from home
View GitHub Profile
@vampaynani
vampaynani / sendmails.rb
Created August 25, 2015 15:54
Outlook mailing from Ruby (Only for Windows)
require 'win32ole'
outlook = WIN32OLE.new('Outlook.Application')
message = outlook.CreateItem(0)
message.Subject = 'Hola Mundo'
message.Body = 'Mail de prueba'
message.BCC = '' #Con copia para
message.SentOnBehalfOfName = '' #Mandar el correo a nombre de otro
message.To = 'receiver@mail.com' #Mail de quien recibirá el mensaje
#message.Attachments.Add('path/to/file') #En caso de querer adjuntar un archivo
@vampaynani
vampaynani / cat.js
Last active July 22, 2023 01:47
Fórmula CAT / Calculadora CAT
/*************
*
* @amount => Cantidad prestada neta(No se restan cargos ni se suman intereses)
* @charge => Cargos por apertura
* @byPeriod => Pago periódico
* @totalPayments => Total de pagos(Años, Meses, Quincenas, Días)
* @periodsByYear => Periodos por año de acuerdo a Banxico(Días: 360, Semanas: 52, Quincenas: 24, Meses: 12, Trimestres: 4)
*
*************/
var _ = require('lodash');
var data = {};
var casper = require('casper').create({
viewportSize: {
width: 800,
height: 600
},
clientScripts: [
'include/jquery-1.11.3.min.js',
'include/lodash.min.js'
@vampaynani
vampaynani / PDODB.php
Last active March 3, 2016 18:50
PDO Basic usage
<?php
include_once('core.php');
include_once('PDOResult.php');
class PDODB{
private $DBH;
protected $table;
protected function __construct(){
try{
$this->DBH = new PDO("mysql:host=".DB_HOST.";dbname=".DB_NAME, DB_USR, DB_PWD);
@vampaynani
vampaynani / Gemfile
Last active September 29, 2016 18:40
Instagram Media Tag Search
source "https://rubygems.org"
gem 'nokogiri'
gem 'sinatra'
gem 'headless'
gem 'watir'
@vampaynani
vampaynani / bot.js
Last active January 26, 2017 01:06
Basic Slack Bot [NodeJS]
var prompt = require('prompt');
var fs = require('fs');
var request = require('request');
fs.readFile('package.json','utf8', function(err, data){
var package=JSON.parse(data);
prompt.start();
prompt.get(['username'], function(err, result){
var username = result['username'] || process.env.USER || process.env.USER_PROFILE,
version = package.version;
@vampaynani
vampaynani / .bash_profile
Created December 13, 2016 16:05
Bash script to format as $username@path_to_current_directory[git branch]
# get current branch in git repo
function parse_git_branch() {
BRANCH=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`
if [ ! "${BRANCH}" == "" ]
then
STAT=`parse_git_dirty`
echo "[${BRANCH}${STAT}]"
else
echo ""
fi
@vampaynani
vampaynani / socket.io_client.js
Last active January 29, 2018 16:42
Socket.io multiplayer basis
const Client = {
socket: io(),
zombieManager: false,
newPlayer: function(){
this.socket.emit('newplayer');
},
playerMove: function(x, y){
this.socket.emit('move', {x, y});
},
shootBeam: function(x, y, angle, velocity){
@vampaynani
vampaynani / travis_setup_heroku_Win10
Last active November 9, 2017 08:07
Some of my windows 10 students are having troubles with Heroku deployment using `travis setup heroku`, they are receiving a `Path not found` error and nothing works. To solve it we did the next steps(all from git bash inside the project folder).
1. `travis encrypt $(heroku auth:token) --add deploy.api_key`
2. inside `deploy:` add `provider:heroku` before `api_key: ...`
3. inside `deploy:` after `api_key` add `app: <name_of_the_heroku_app>`
@vampaynani
vampaynani / Uploader.js
Created November 21, 2017 16:31
Upload Documents Component
// Import
import React, { Component } from 'react';
import {connect} from 'react-redux';
import * as actions from '../actions';
import Dialog from 'material-ui/Dialog'
import FlatButton from 'material-ui/FlatButton';
import IconButton from 'material-ui/IconButton';
import LinearProgress from 'material-ui/LinearProgress';
import ActionBackup from 'material-ui/svg-icons/action/backup';
import * as Styles from '../constants/Styles';