Skip to content

Instantly share code, notes, and snippets.

@thiagoh
thiagoh / floating.css
Created March 13, 2017 03:05
floating left experiments
<!doctype html>
<html>
<head>
<style type="text/css">
div {
padding: 10px;
border: 1px solid black;
margin: 0px;
float: left;
@thiagoh
thiagoh / basic-media-queries.html
Last active March 4, 2017 21:24
basic media queries
<!doctype html>
<html>
<head>
<title>My First HTML Page</title>
<!--<meta name="viewport" content="width=1200, initial-scale=1">-->
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
#left {
/*
* This code was inspired by AngularJS $resource object
* on which you can do something like this:
var users = User.query(function() {
console.log(users[0]);
});
* Source code: https://github.com/angular/angular.js/blob/master/src/ngResource/resource.js#L76
*/
@thiagoh
thiagoh / SMBDIS.ASM
Created January 25, 2017 22:42 — forked from 1wErt3r/SMBDIS.ASM
A Comprehensive Super Mario Bros. Disassembly
;SMBDIS.ASM - A COMPREHENSIVE SUPER MARIO BROS. DISASSEMBLY
;by doppelganger (doppelheathen@gmail.com)
;This file is provided for your own use as-is. It will require the character rom data
;and an iNES file header to get it to work.
;There are so many people I have to thank for this, that taking all the credit for
;myself would be an unforgivable act of arrogance. Without their help this would
;probably not be possible. So I thank all the peeps in the nesdev scene whose insight into
;the 6502 and the NES helped me learn how it works (you guys know who you are, there's no
@thiagoh
thiagoh / bash-utils.sh
Last active March 23, 2017 18:10
bash util commands
# kill a specific process
$ ps aux | grep $process_to_kill_name | tr -s ' ' | cut -d ' ' -f2 | xargs kill -9
# read a specific $gist_nth gist
$ gist --list | head -n $gist_nth | cut -d ' ' -f1 | rev | cut -d '/' -f1 | rev | xargs gist -r
//
// main.swift
// SwiftTests
//
// Created by Thiago Andrade on 2017-01-08.
// Copyright © 2017 Thiago Andrade. All rights reserved.
//
import Foundation
var createPromise = function(label, time) {
return function() {
return new Promise(function(resolve) {
setTimeout(function() {
console.log(label);
resolve();
}, time);
@thiagoh
thiagoh / bash.generate.random.alphanumeric.string.sh
Created November 19, 2016 19:52 — forked from earthgecko/bash.generate.random.alphanumeric.string.sh
shell/bash generate random alphanumeric string
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1
@thiagoh
thiagoh / php-7-closures.php
Created October 20, 2016 23:20
PHP 7 Closures example
php > $x = 123;
php > $var4 = static function() use(&$x) {return $x;}; // with 'static'
php > echo $var4();
123
php > echo (function() use(&$x) {return $x;})();
123
php > $var4 = (function() use(&$x) {return $x;}); // without 'static'
php > echo $var4();
123
php > $x = 321;
@thiagoh
thiagoh / ReferencesTest.java
Created July 7, 2016 17:55
WeakReference example
package com.liferay.portal.service;
import java.lang.ref.Reference;
import java.lang.ref.ReferenceQueue;
import java.lang.ref.WeakReference;
import java.util.HashMap;
import java.util.Map;
public class ReferencesTest {