Skip to content

Instantly share code, notes, and snippets.

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

Luis Alfredo Porras Páez lporras

🏠
Working from home
View GitHub Profile
@lporras
lporras / GetTweets_GraphQL.json
Created January 2, 2019 18:18
Get Tweets with GraphQL
query {
twitter {
ReactTweets: search(q: "ReactJs") {
...camposTweet
}
GraphQLTweets: search(q: "GraphQL") {
...camposTweet
created_at
}
JavascriptTweets: search(q: "Javascript") {
@lporras
lporras / dependable_dropdown_with_macros.rb
Created January 23, 2018 21:49
dependable dropdown with macros
require 'write_xlsx'
#workbook = WriteXLSX.new('write_xlsx_example.xlsx')
workbook = WriteXLSX.new('write_xlsx_example.xlsm')
workbook.add_vba_project('./vbaProject.bin')
dropdownSheet = workbook.add_worksheet('DropDown Values')
dropdownSheet.add_table('A1:A2', {
data: [
['HOMBRES']
@lporras
lporras / lock_unlock_cells.vb
Created January 23, 2018 20:37
Lock & UnLock Cells visual basic
Sub unlockCells()
'
' unlockcell Macro
'
' Método abreviado de teclado: Opción+Cmd+e
'
Dim chRng As Range
Worksheets("Sheet2").Unprotect ("password")
Set chRng = Worksheets("Sheet2").Range("E1:E100")
@lporras
lporras / macro.vb
Last active October 19, 2019 20:53
How to run a macro when certain cells change in Excel
Private Sub Worksheet_Change(ByVal Target As Range)
Dim KeyCells As Range
' The variable KeyCells contains the cells that will
' cause an alert when they are changed.
Set KeyCells = Range("A1:C10")
If Not Application.Intersect(KeyCells, Range(Target.Address)) _
Is Nothing Then
@lporras
lporras / data_validation_example.rb
Created January 5, 2018 19:04
DataValidation Example with write_xlsx Gem
require 'write_xlsx'
workbook = WriteXLSX.new('write_xlsx_example.xlsx')
dropdownSheet = workbook.add_worksheet('DropDown Values')
dropdownSheet.write_row(0,0,['open', 'high', 'close'])
dropdownSheet.protect('password')
worksheet = workbook.add_worksheet
@lporras
lporras / data_validation_list.rb
Last active December 20, 2017 22:15
Data Validation List Excel
## AXLSX Gem Example
require 'axlsx'
excel = Axlsx::Package.new
wb = excel.workbook
months_sheet = wb.add_worksheet(:name => 'DropDown Values') { |ws| ws.sheet_protection.password = 'pa55w0rd' }
months_sheet.add_row ['value1', 'value2', 'value3']
wb.add_worksheet(name: "sample_sheet") do |sheet|
@lporras
lporras / OpenWithSublimeText3.bat
Created November 29, 2017 21:40 — forked from roundand/OpenWithSublimeText3.bat
Open folders and files with Sublime Text 3 from windows explorer context menu (tested in Windows 7)
@echo off
SET st3Path=C:\Program Files\Sublime Text 3\sublime_text.exe
rem add it for all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_EXPAND_SZ /v "Icon" /d "%st3Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3\command" /t REG_SZ /v "" /d "%st3Path% \"%%1\"" /f
rem add it for folders
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@lporras
lporras / ruby_ftp_example.rb
Created November 16, 2017 21:42 — forked from 3dd13/ruby_ftp_example.rb
Sample code of using Ruby Net::FTP library. Login to FTP server, list out files, check directory existence, upload files
require 'net/ftp'
CONTENT_SERVER_DOMAIN_NAME = "one-of-the-ftp-server.thought-sauce.com.hk"
CONTENT_SERVER_FTP_LOGIN = "saucy-ftp-server-login"
CONTENT_SERVER_FTP_PASSWORD = "saucy-ftp-server-password"
# LOGIN and LIST available files at default home directory
Net::FTP.open(CONTENT_SERVER_DOMAIN_NAME, CONTENT_SERVER_FTP_LOGIN, CONTENT_SERVER_FTP_PASSWORD) do |ftp|
files = ftp.list
@lporras
lporras / giphy.js
Created August 14, 2017 16:31
webtask giphy example
"use latest";
var handlebars = require('handlebars');
var request = require('request');
var View = `
<html>
<head>
<title>Giphy</title>
</head>
<body>
@lporras
lporras / ocr.rb
Created October 3, 2016 14:54 — forked from jyunderwood/ocr.rb
require 'base64'
require 'open-uri'
require 'net/http'
require 'net/https'
require 'json'
class OCR
attr_reader :api_key, :image_url
def self.scan(api_key:, image_url:)