Skip to content

Instantly share code, notes, and snippets.

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

Jorge Morales morales2k

🏠
Working from home
View GitHub Profile
@morales2k
morales2k / .bash_profile
Last active December 12, 2017 19:27
My entire bash_profile aliases.
#nvm stuff their installer adds
export NVM_DIR=~/.nvm
source $(brew --prefix nvm)/nvm.sh
#nvm stuff end...
#add composer to PATH
export PATH=~/.composer/vendor/bin:$PATH
#aliases to make my life easier
alias phpunit=./vendor/bin/phpunit
@morales2k
morales2k / print_r snippet.sublime-snippet
Created July 24, 2014 20:36
Snippet for sublime text for quickly producing print_r blocks that are pretty.
<snippet>
<content><![CDATA[
echo '<pre>'; print_r(${1:ARRAY}); echo '</pre>';
]]></content>
<description>PHP: Pretty print_r</description>
<scope>source.php</scope>
<tabTrigger>prnt</tabTrigger>
</snippet>
@morales2k
morales2k / scroll-over-map.html
Last active November 21, 2016 16:37
Obscure a google maps embedded iframe so one can scroll/pan on it without affecting the map unless we click or tap the map to activate it.
<div class="map embed-container">
<div id="map-notice" style="display: block;"> {Tell your users what to do!} </div>
<div class="map-overlay" style="display: block;"></div>
<iframe style="width:100%" src="https://www.google.com/maps/embed?pb=!1m14!1m8!1m3!1d3785.684302567802!2d-66.15578327375803!3d18.40721382009222!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x8c036a35d02b013f%3A0x5962cad95b9ec7f8!2sPlaza+Del+Sol!5e0!3m2!1sen!2spr!4v1415284687548" width="633" height="461" frameborder="0"></iframe>
</div>
@morales2k
morales2k / url_matching_regex.txt
Created September 13, 2016 22:12
Regex to match urls
^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,12})([\/\w-\.]*)?\??([=\w+&%\s-]?)*$
@morales2k
morales2k / bulkdelete.py
Last active June 8, 2016 12:03
Delete files from slack for each access token in the list. Based on: https://gist.github.com/thesoftwarejedi/d78af9ee12b7f7a9d3e7
import requests
import json
import calendar
import sys
import codecs
from datetime import datetime, timedelta
sys.stdout = codecs.getwriter("utf-8")(sys.stdout, 'strict')
_tokens = ["TOKEN_LIST"]
@morales2k
morales2k / ssh_somewhere.command
Created May 10, 2016 16:55
Bash script to ssh into an amazon or other remote host. I made this script to have a single shortcut on my desktop to use in order to load a routine that would simplify establishing an ssh pipe to our remote servers, in this snippet 2 servers are used, but as you can see, it can be scaled up easily by adding more options/cases in the code. Happy…
#!/bin/bash
# Bash script to ssh into an amazon or other remote host. I made this script to have a single shortcut on my desktop to use in order to load a routine that would simplify establishing an ssh pipe to our remote servers, in this snippet 2 servers are used, but as you can see, it can be scaled up easily by adding more options/cases in the code. Happy Coding!
# Author: Jorge Morales
#UPDATE THESE VARIABLES WHENEVER THERE ARE CHANGES
test_server="TEST_SERVER_HOST_ADDRESS"
production_server="PRODUCTION_SERVER_HOST_ADDRESS"
pathToCertificate="PATH_TO_KEYFILE"
echo "Type 1 to connect to Test server."
echo "Type 2 to connect to Production server."
@morales2k
morales2k / jquery-sidr.js
Created July 8, 2014 17:31
The jquery-sidr fix that made it work for me in all browsers. Try it out and see if it helps!
/*
* Sidr
* https://github.com/artberri/sidr
*
* Copyright (c) 2013 Alberto Varela
* Licensed under the MIT license.
*/
;(function( $ ){
@morales2k
morales2k / gaq.push
Created November 7, 2013 13:45
Google Analytics -> One push, multiple UA tracking codes.
_gaq.push(
['_setAccount', 'UA-XXXXX-1'],
['_trackPageview'],
['b._setAccount', 'UA-XXXXX-2'],
['b._trackPageview']
);
@morales2k
morales2k / gist:6193580
Last active December 20, 2015 20:49
Google Analytics function for custom events for analytics.js Use it anyway you want, from simply adding onclick attribute to an element other than <a> to track a click event. Easily customizable to make it track other stuff besides event hitType, or click action for that matter. See analytics.js documentation https://developers.google.com/analyt…
/*!
* Tracking function to be used with the new analytics.js (i,s,o,g,r,a,m) snippet
* @param el string Identifier for the tracking click event
* @author Jorge L. Morales (EffectiX.Net)
* @return void
*/
function gaTrack(el){
ga('send',
{
'hitType': 'event',
@morales2k
morales2k / default.sublime-keymap
Last active December 20, 2015 05:49
Sublime Text 2 reindent full document shortcut keybinding. This gist is to be added to user keybindings to set f12 key to issue the reindent command to the complete document instead of doing it to a single line as it does when doing it from the menu. One normally selects all the document before doing this command from the menu, with the argument…
[
{
"keys": ["f12"],
"command": "reindent",
"args": {
"single_line": false
}
}
]