Skip to content

Instantly share code, notes, and snippets.

View rictorres's full-sized avatar
💅
startuppin'

Ricardo Torres rictorres

💅
startuppin'
View GitHub Profile
@rictorres
rictorres / .htaccess
Created July 16, 2012 21:27 — forked from necolas/.htaccess
Simple, quick way to concatenate, minify, and version static files in a Wordpress theme
# Filename-based cache busting
# taken from https://github.com/h5bp/html5-boilerplate/
# This rewrites file names of the form `name.123456.js` to `name.js`
# so that the browser doesn't use the cached version when you have
# updated (but not manually renamed) the file.
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On

JavaScript to Rust Cheat Sheet

The goal of this is to have an easily-scannable reference for the most common syntax idioms in JavaScript and Rust so that programmers most comfortable with JavaScript can quickly get through the syntax differences and feel like they could read and write basic Rust programs.

What do you think? Does this meet its goal? If not, why not?

Variables

JavaScript:

@rictorres
rictorres / letsencrypt_2018.md
Created June 18, 2018 20:45 — forked from cecilemuller/letsencrypt_2020.md
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)

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


Virtual hosts

Let's say you want to host domains first.com and second.com.

Create folders for their files:

/*
* Minimal classList shim for IE 9
* By Devon Govett
* MIT LICENSE
*/
if (!("classList" in document.documentElement) && Object.defineProperty && typeof HTMLElement !== 'undefined') {
Object.defineProperty(HTMLElement.prototype, 'classList', {
get: function() {
(function (window) {
// This library re-implements setTimeout, setInterval, clearTimeout, clearInterval for iOS6.
// iOS6 suffers from a bug that kills timers that are created while a page is scrolling.
// This library fixes that problem by recreating timers after scrolling finishes (with interval correction).
// This code is free to use by anyone (MIT, blabla).
// Author: rkorving@wizcorp.jp
var timeouts = {};
var intervals = {};
/*
* Normalized hide address bar for iOS & Android
* (c) Scott Jehl, scottjehl.com
* MIT License
*/
(function( win ){
var doc = win.document;
// If there's a hash, or addEventListener is undefined, stop here
if( !location.hash && win.addEventListener ){
<?php
class Cidades_estados_pais extends CI_Model {
public function index() {
//-----------------------------------------------
// Se preferir altere o nome da tabela e colunas
//
$tabela = 'sys_cidades_estados_pais';
# ~/.osx — http://mths.be/osx
# root check
if [[ $EUID -ne 0 ]]; then
echo "################################";
echo "## YOU ARE NOT RUNNING AS ROOT #";
echo "################################";
echo "#";
echo "# USAGE: sudo $0";
exit;
function autogrow(textarea) {
// create fake div with same content
// (only works with box-sizing border-box)
var dv = document.createElement("div");
dv.className = 'fm-growable';
dv.style.visibility="hidden";
dv.style.position="absolute";
textarea.parentNode.appendChild(dv);