This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function() { | |
$(document).on('copy', function () { | |
var selection = window.getSelection(); | |
var copyFooter = '<br><br>Leia mais em <a href="' + document.location.href + '">' + document.location.href + '</a>'; | |
var copyHolder = $('<div>', { | |
html: (selection + '').substring(0, 140) + '...' + copyFooter, | |
style: { | |
position: 'absolute', | |
left: '-99999px'} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# From https://httpd.apache.org/docs/2.4/mod/mod_authz_core.html | |
# and https://httpd.apache.org/docs/2.4/vhosts/mass.html. | |
UseCanonicalName Off | |
LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon | |
<Directory "/home/deploy/sites"> | |
Options FollowSymLinks | |
AllowOverride All | |
Require all granted | |
</Directory> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function jwtDecode(token) { | |
var base64Url = token.split('.')[1]; | |
var base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/'); | |
var payload = decodeURIComponent(atob(base64).split('').map(function(c) { | |
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2); | |
}).join('')); | |
return JSON.parse(payload); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Array.prototype.orderItems = function(newer, older) { | |
var list = new Array(...this) | |
return list.splice(newer - 1, 0, ...list.splice(older, 1)) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
#/ Usage: <progname> [options]... | |
#/ How does this script make my life easier? | |
# ** Tip: use #/ lines to define the --help usage message. | |
$stderr.sync = true | |
require 'optparse' | |
# default options | |
flag = false | |
option = "default value" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
require 'sinatra' | |
set server: 'thin', connections: [] | |
get '/' do | |
halt erb(:login) unless params[:user] | |
erb :chat, locals: { user: params[:user].gsub(/\W/, '') } | |
end | |
get '/stream', provides: 'text/event-stream' do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Configuration | |
PLUGIN_NAME = markdown | |
PLUGIN_VERSION = 2.0.0 | |
MAKEDIR = build | |
HOMEDIR = tmp | |
SRCDIR = src | |
PKGDIR = pkg | |
SYNTAX = $(MAKEDIR)/syntax/$(PLUGIN_NAME).vim |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package learn; | |
import static spark.Spark.*; | |
import spark.*; | |
import java.io.*; | |
import java.util.Map; | |
import java.util.HashMap; | |
import java.util.regex.Pattern; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'sinatra' | |
require 'sinatra/mapping' # only this line for use mapping! | |
map :root, "blog" # /blog/ | |
map :entries, "posts" # /blog/posts | |
map :tags, "labels" # /blog/labels | |
mapping :entry => "posts/:entry_id", # /blog/posts/id-for-post |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'sinatra' | |
require 'sinatra/mapping' | |
require 'blogware' | |
run Sinatra::Application |
NewerOlder