Skip to content

Instantly share code, notes, and snippets.

Karl karlcoelho

Block or report user

Report or block karlcoelho

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
karlcoelho / darken.css
Created Feb 24, 2016
darken background image so overtext is clear
View darken.css
.main {
background-image: linear-gradient(
rgba(0, 0, 0, 0.6),
rgba(0, 0, 0, 0.6)
), url(image.jpg);
karlcoelho / random.rb
Created Feb 19, 2016
Generate a random string in Ruby
View random.rb
def random_string(length)
# rand(36**length).to_s(36)
karlcoelho / app.rb
Created Jan 30, 2016
CORS for Sinatra
View app.rb
before do
headers['Access-Control-Allow-Methods'] = 'GET, POST, PUT, DELETE, OPTIONS'
headers['Access-Control-Allow-Origin'] = '*'
headers['Access-Control-Allow-Headers'] = 'accept, authorization, origin'
options '*' do
response.headers['Allow'] = 'HEAD,GET,PUT,DELETE,OPTIONS,POST'
response.headers['Access-Control-Allow-Headers'] = 'X-Requested-With, X-HTTP-Method-Override, Content-Type, Cache-Control, Accept'
karlcoelho /
Created Dec 15, 2015 — forked from eclubb/
Script to import SQLite3 database into PostgreSQL
# This script will migrate schema and data from a SQLite3 database to PostgreSQL.
# Schema translation based on
# Some column types are not handled (e.g blobs).
View file.php
// slack2html
// by @levelsio
karlcoelho / background-image.css
Created Nov 4, 2015
Stretch the background image over the whole page
View background-image.css
background: url(images/bg.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
karlcoelho / rendering.css
Created Oct 31, 2015
Make text look good with CSS
View rendering.css
-webkit-font-smoothing: antialiased;
font-smoothing: antialiased;
-moz-font-smoothing: antialiased;
text-rendering: optimizeLegibility;
View sticky-div.html
<script src=""></script>
$(function() {
karlcoelho / tweet.html
Created Oct 16, 2015
Simple Tweet Button
View tweet.html
<a href="" class="twitter-share-button" data-text="Check this out" data-via="therealcoelho" data-size="large">Tweet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);;js.src=p+'://';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
karlcoelho / simple-nav.html
Created Oct 9, 2015
Simple Bootstrap Navbar
View simple-nav.html
<nav class="navbar navbar-default">
<div class="container">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<div class="navbar-header">
<a class="navbar-brand" href="#">Brand</a>
You can’t perform that action at this time.