Skip to content

Instantly share code, notes, and snippets.

View andresmgsl's full-sized avatar
🔥
Building things

Andres Guerrero andresmgsl

🔥
Building things
View GitHub Profile
@andresmgsl
andresmgsl / emoji_sheet_code.md
Last active June 21, 2020 10:50 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@andresmgsl
andresmgsl / timeout.html
Created October 19, 2019 12:26 — forked from kumikoda/timeout.html
A simple example demonstrating how setTimeout(fn, 0) can be useful. This gist illustrates the answer given by DVK's on stackoverflow. http://stackoverflow.com/a/4575011/783478
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<button id='do'> Do long calc!</button>
<div id='status'></div>
<div id='result'></div>
<script>
$('#do').on('click', function(){
@andresmgsl
andresmgsl / .htaccess
Created July 23, 2018 01:46 — forked from julianpoemp/.angular-htaccess.md
Optimal .htaccess configuration for an Angular 5 App in production
# place this file in the same folder as your index.html on your server
# make sure to set the right base href attribute in your index.html
# this file ist hosted on GithubGist:
# https://gist.github.com/julianpoemp/bcf277cb56d2420cc53ec630a04a3566
# REDIRECTION
# to index.html to make routing work in production
<IfModule mod_rewrite.c>
RewriteEngine on

Contributing

When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.

Please note we have a code of conduct, please follow it in all your interactions with the project.

Pull Request Process

  1. Ensure any install or build dependencies are removed before the end of the layer when doing a
#add 'node_modules' to .gitignore file
git rm -r --cached node_modules
git commit -m 'Remove the now ignored directory node_modules'
git push origin master
@andresmgsl
andresmgsl / gist:78d7226602ca09bb828cdc3e4e953a68
Created January 27, 2018 01:50 — forked from tamoyal/gist:10441108
Create super user and database user in Mongo 2.6
# Create your superuser
$ mongo
> use admin
> db.createUser({user:"someadmin",pwd:"secret", roles:[{role:"root",db:"admin"}]})
> exit
# Alias for convenience (optional and at your own risk)
$ echo 'alias mongo="mongo --port 27017 -u someadmin -p secret --authenticationDatabase admin"' >> ~/.bash_profile
$ source ~/.bash_profile
@andresmgsl
andresmgsl / cors.nginxconf
Created February 17, 2017 02:20 — forked from pauloricardomg/cors.nginxconf
Nginx configuration for CORS-enabled HTTPS proxy with origin white-list defined by a simple regex
#
# Acts as a nginx HTTPS proxy server
# enabling CORS only to domains matched by regex
# /https?://.*\.mckinsey\.com(:[0-9]+)?)/
#
# Based on:
# * http://blog.themillhousegroup.com/2013/05/nginx-as-cors-enabled-https-proxy.html
# * http://enable-cors.org/server_nginx.html
#
server {
@andresmgsl
andresmgsl / letsencrypt_2016.md
Created January 29, 2017 19:30 — forked from cecilemuller/letsencrypt_2020.md
How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

There are two modes when you don't want Certbot to edit your configuration:

  • Standalone: replaces the webserver to respond to ACME challenges
  • Webroot: needs your webserver to serve challenges from a known folder.

Webroot is better because it doesn't need to replace Nginx (to bind to port 80) to renew certificates.

In the following, we're setting up mydomain.com to be served from /var/www/mydomain, and challenges will be served from /var/www/letsencrypt.

# Source: http://choyan.me/oh-my-zsh-elementaryos/
sudo apt-get update && sudo apt-get install -y curl vim git zsh
curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | bash
sudo chsh -s $(which zsh) $(whoami)
db.images.find({}).forEach(function(doc){
var regexp = /(.*)\.[^.]+$/;
var thumbName = doc.name.split('.').reverse().slice(1);
db.images.update(
{number:doc.number},
{ $set:
{"path": {
"url" : "assets/images/users/" + doc.username + "/pieces/" + doc.number + "/" + doc.name,
"thumb": "assets/images/users/" + doc.username + "/pieces/" + doc.number + "/" + thumbName + "_thumb.jpg"}
}