Skip to content

Instantly share code, notes, and snippets.

View chrisenytc's full-sized avatar
👨‍💻

Christopher Enytc chrisenytc

👨‍💻
View GitHub Profile
@chrisenytc
chrisenytc / aws-metadata.sh
Created July 22, 2018 05:43
Creating wildcard ssl with certbot on AWS
#!/bin/bash
set -e
# Set environment variables
export AWS_IAM_ROLE=$(curl "http://169.254.169.254/latest/meta-data/iam/security-credentials/" 2>/dev/null)
if [ "${AWS_IAM_ROLE}" ]; then
export AWS_ACCESS_KEY_ID=$(curl "http://169.254.169.254/latest/meta-data/iam/security-credentials/${AWS_IAM_ROLE}" 2>/dev/null | jq -r .AccessKeyId)
export AWS_SECRET_ACCESS_KEY=$(curl "http://169.254.169.254/latest/meta-data/iam/security-credentials/${AWS_IAM_ROLE}" 2>/dev/null | jq -r .SecretAccessKey)
@chrisenytc
chrisenytc / directives.js
Created October 3, 2014 13:15
Add class active to a menu with AngularJS directive
'use strict';
angular.module('App').directive('isActive', ['$location', function($location) {
return {
restrict: 'A',
link: function(scope, element) {
scope.location = $location;
scope.$watch('location.path()', function(currentPath) {
var formatedPath = '';
if(currentPath === '/') {
var http = require('http');
// Criando o servidor para o proxy
http.Server(function(req, res){
res.writeHead(200, {
'Content-Type' : 'application/json; charset=utf-8',
'Transfer-Encoding' : 'chunked'
});
setInterval(function(){
@gpedro
gpedro / README.md
Last active February 25, 2019 14:13
beeg hotlink
  1. Create new Bookmark and on url paste code below:
javascript:function createLinks(){$(document).ready(function(){$(".hotblock table tbody tr").each(function(e,c){var a=$(c).children("td");$(a).each(function(c,a){var b=$(a).children("img"),d=/\d{7}/.exec(b.attr("data-original"));null!=d&&(b.attr("onClick","javascript:window.open('http://beeg.com/"+d+"')"),b.attr("style","cursor:pointer"))})})})}createLinks();void(0);
  1. Access beeg.com and search for video and check in bottom page if have a another hot videos. If yes, click in bookmark and have fun (:

Regular Expressions

Basic Syntax

  • /.../: Start and end regex delimiters
  • |: Alternation
  • (): Grouping
@vitorbritto
vitorbritto / regex.md
Last active May 2, 2024 13:24
Regex Cheat Sheet

Regular Expressions

Basic Syntax

  • /.../: Start and end regex delimiters
  • |: Alternation
  • (): Grouping
app.factory('Session', [function(){
var set = function(name, data) {
sessionStorage.setItem(name, JSON.stringify(data));
}
var destroy = function(name) {
sessionStorage.removeItem(name);
}
var get = function(name) {
return JSON.parse(sessionStorage.getItem(name));
}
// Imagine que esse ẽ o modulo1.js
var somar = function(a, b){
return a + b;
};
// Aqui estou dizendo para o require que ele pode usar
// a função que está linkada a esta variável
module.exports = somar;
@hdubugras
hdubugras / gist:9985111
Last active August 29, 2015 13:58
VAGA DESENVOLVEDOR BACK-END Pagar.me

VAGA DESENVOLVEDOR BACK-END

O Pagar.me está crescendo e o nosso time também. Para isso, estamos contratando desenvolvedores para nos ajudar a resolver os grandes problemas do mercado de pagamentos brasileiro. Nossa aplicação é escrita principalmente em Javascript (Node.js e AngularJS) e somos fortemente adeptos a novas tecnologias. Adoramos usar as ferramentas certas para resolver nossos problemas e somos totalmente obcecados por testes e filosofia open-source.

Não procuramos pessoas apenas excepcionais em Javascript, Ruby ou outra linguagem, mas também em computação em si. Queremos gente apaixonada por UNIX, otimização (incluindo do seu editor de texto), testes, segurança e consistência. Amamos os que programam desde a adolescência ou infância e que não consigam dormir até resolver um problema.

Seguem algumas reportagens sobre o pagar.me e os fundadores:

@hugooliveirad
hugooliveirad / git-sync-fork.sh
Created February 21, 2014 21:33
Sync Fork On GitHub
# Sync fork with original repository
#
# Requires an "upstream" remote, pointing to original repo
# e.g. `git remote add upstream git@github.com:user/repo.git`
alias git-sync-fork="git fetch upstream; git checkout master; git merge upstream/master"