Skip to content

Instantly share code, notes, and snippets.

View DiegoSalazar's full-sized avatar

Diego E. Salazar DiegoSalazar

View GitHub Profile
@DiegoSalazar
DiegoSalazar / Basic API call (Office 2013).WORD.yaml
Created April 20, 2021 00:44
Performs a basic Word API call using JavaScript with the "common API" syntax (compatible with Office 2013).
name: Basic API call (Office 2013)
description: >-
Performs a basic Word API call using JavaScript with the "common API" syntax
(compatible with Office 2013).
host: WORD
api_set: {}
script:
content: |
$("#run").click(run);
@DiegoSalazar
DiegoSalazar / Basic API call (TypeScript).WORD.yaml
Created February 17, 2021 21:58
Performs a basic Word API call using TypeScript.
name: Basic API call (TypeScript)
description: Performs a basic Word API call using TypeScript.
host: WORD
api_set: {}
script:
content: |
$("#run").click(() => tryCatch(run));
async function run() {
// Gets the current selection and changes the font color to red.
@DiegoSalazar
DiegoSalazar / us-states.tsv
Created December 9, 2020 19:53
List of US States
AK Alaska
AL Alabama
AR Arkansas
AZ Arizona
CA California
CO Colorado
CT Connecticut
DE Delaware
FL Florida
GA Georgia
@DiegoSalazar
DiegoSalazar / index.html
Created April 2, 2020 17:32
test dumber gist
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Dumber Gist</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no">
<base href="/">
</head>
<!--
Dumber gist uses dumber bundler, the default bundle file
@DiegoSalazar
DiegoSalazar / scratch.rb
Last active February 3, 2017 05:26
Implementation of Floyd's Cycle Detection Algorithm
class Node
attr_reader :value
attr_accessor :next_node
def initialize(value, next_node = nil)
@value = value
@next_node = next_node
end
def end?
@DiegoSalazar
DiegoSalazar / scratch.rb
Last active May 4, 2017 02:38
Linked list reversal solutions
# A node of a linked list
class Node
attr_reader :value, :next_node
def initialize(value, next_node = nil)
@value = value
@next_node = next_node
end
def reverse(reversed = nil)
@DiegoSalazar
DiegoSalazar / paginatedAutocomplete.js
Created October 27, 2016 15:42
jQuery UI wrapper over Autocomplete that adds pagination
$.widget("paginatedAutocomplete", $.ui.autocomplete, {
options: {
minLength: 1,
sourceUrl: '',
pageSize: 10,
source: function (request, response) {
var self = this;
$.ajax({
url: this.options.sourceUrl,

Keybase proof

I hereby claim:

  • I am diegosalazar on github.
  • I am diegosalazar (https://keybase.io/diegosalazar) on keybase.
  • I have a public key ASCUA8M_jJ9DZRPNgZJY_aOjxwsaAnG8ujhjOTWYTpVTSQo

To claim this, I am signing this object:

@DiegoSalazar
DiegoSalazar / .bash_overrides.sh
Last active September 22, 2016 16:31
Prevents accidentally exiting the shell
# Prevent me from accidentally exiting the shell
exit() {
echo "Exit the shell? y/n"
read a
if [ "$a" = "y" ]; then
builtin exit
fi
}
@DiegoSalazar
DiegoSalazar / convert_hash_to_html.rb
Created July 13, 2016 21:05
convert a hash to html
def convert_hash_to_html(data)
html = "<dl>"
data.each do |key, val|
html << "<dt>#{key}</dt>"
if val.is_a? Hash
html << "<dd>#{convert_hash_to_html val}</dd>"
elsif val.is_a? Array
html << "<dd>#{convert_array_to_html val}</dd>"