Skip to content

Instantly share code, notes, and snippets.

View edelgado's full-sized avatar

Enrique Delgado edelgado

View GitHub Profile
@edelgado
edelgado / safeCypressRecordRun.js
Created October 14, 2019 01:51
Safely Run Cypress Tests
/*
The free Cypress tier which limits run records to 500.
Once the limit is reached, it does not run the tests and exists with an error code.
This makes CI tests fail, and the PR checks to fail as result. We do not want that
to happen, so we are using this wrapper run script to attempt to run the tests with
recordings on. If there is an error (eg the limit has been reached), we will attempt
the run again, this time without recording.
Source: https://github.com/cypress-io/cypress/issues/4021
*/
@edelgado
edelgado / txt-to-google-keep-notes.py
Created August 7, 2019 21:47 — forked from sliceofbytes/txt-to-google-keep-notes.py
Add Text Files as Google Keep Notes
#Import a directory of text files as google keep notes.
#Text Filename is used for the title of the note.
import gkeepapi, os
username = 'username@gmail.com'
password = 'your app password'
keep = gkeepapi.Keep()
success = keep.login(username,password)
@edelgado
edelgado / config.json
Created October 19, 2016 17:05 — forked from anonymous/config.json
Bootstrap Customizer Config
{
"vars": {
"@gray-base": "#000",
"@gray-darker": "#818181",
"@gray-dark": "#C3C3C3",
"@gray": "#C3C3C3",
"@gray-light": "#F6F6F6",
"@gray-lighter": "#FFFFFF",
"@brand-primary": "#048A97",
"@brand-success": "#5cb85c",
@edelgado
edelgado / mini_code_challenges.md
Last active June 8, 2016 19:44
Mini Code Challenges

Write a function to determine if a word is an anagram of another.

class String
  def anagram?(str)
    (self.chars - str.chars) == []
  end
end

"anna meme".anagram? "name name" # => true
@edelgado
edelgado / rbenv-install-ruby-1_9_3_p_484_gcdata
Last active December 22, 2015 14:41 — forked from philou/rbenv-patch
This script uses a patch from the rvm repo to patch a ruby-build package before installing it with rbenv. It uses ruby 1.9.3-p484 with gcdata patch, but it should work with any ruby / patch as long as they are compatible.
#!/bin/sh
mkdir /tmp/ruby-build-patch
cd /tmp/ruby-build-patch
# download and patch the ruby sources
wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p484.tar.gz
tar xzf ruby-1.9.3-p484.tar.gz
cd ruby-1.9.3-p484
curl https://raw.githubusercontent.com/wayneeseguin/rvm/master/patches/ruby/1.9.3/p125/gcdata.patch | patch -p1
@edelgado
edelgado / code.js
Created March 7, 2013 17:10
Google Analytics code for phones.digium.com
<script type="text/javascript">
var _gaq = _gaq || [];
// Site-specific GA account:
_gaq.push(['_setAccount', 'UA-5026086-45']);
_gaq.push(['_trackPageview']);
_gaq.push(['_setAllowHash', false]);
// Global GA account:
_gaq.push(['unified._setAccount', 'UA-5026086-44']);
_gaq.push(['unified._trackPageview']);
@edelgado
edelgado / gist:5109733
Created March 7, 2013 17:03
Google Analytics code for developers.digium.com
<script type="text/javascript">
var _gaq = _gaq || [];
// Site-specific GA account:
_gaq.push(['_setAccount', 'UA-5026086-28']);
_gaq.push(['_trackPageview']);
_gaq.push(['_setAllowHash', false]);
// Global GA account:
_gaq.push(['unified._setAccount', 'UA-5026086-44']);
_gaq.push(['unified._trackPageview']);
@edelgado
edelgado / sample.js
Last active December 14, 2015 15:39
New Google Analytics code for wiki.asterisk.org
var _gaq = _gaq || [];
// Site-specific GA account:
_gaq.push(['_setAccount', 'UA-5026086-41']);
_gaq.push(['_trackPageview']);
_gaq.push(['_setAllowHash', false]);
// Global GA account:
_gaq.push(['unified._setAccount', 'UA-5026086-44']);
_gaq.push(['unified._trackPageview']);
// Enhanced link attribution:
_gaq.push(['_require', 'inpage_linkid', pluginUrl]);
@edelgado
edelgado / mod_rewrite.sample
Last active December 12, 2015 01:38
mod_rewrite rule (to be placed inside .htaccess or a <virtualhost> directive in Apache)
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteRule ^/?$ http://theurltoredirecthere [R=301,L]
</IfModule>
@edelgado
edelgado / developers.digium.com.js
Created February 1, 2013 16:36
Google Analytics tracking codes
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-5026086-46']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);