Skip to content

Instantly share code, notes, and snippets.

View fernandohenriques's full-sized avatar

Fernando Henriques fernandohenriques

View GitHub Profile
@fernandohenriques
fernandohenriques / helper.rb
Created February 7, 2018 03:32
Seconds to H:M
module ControllerHelper
def secondsToHM(s)
Time.at(s).utc.strftime("%H:%M")
end
end
@fernandohenriques
fernandohenriques / index.html
Created January 31, 2018 05:49
Intelligence when show ads - Five times one, one time other
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Intelligence when show ads - Five times one, one time other</title>
<style type="text/css">
#googleadsheader.ads1{ width:728px; height:90px }
#googleadsheader.ads2{ width:970px; height:250px }
</style>
<script type="text/javascript">
@fernandohenriques
fernandohenriques / getStyle.js
Last active January 13, 2018 22:34
Read CSS rule values with JavaScript
import getStyle from "./getStyleContent"; //ES6
let styleContent = getStyle('.test');
console.log(styleContent);
/*
Returns:
.test {
@fernandohenriques
fernandohenriques / hex2rgb.lua
Last active June 19, 2022 11:00
Corona SDK use just RGB colors. This function convert HEX to RGB.
-- path for this file: src/utils/
function hex2rgb (hex)
local hex = hex:gsub("#","")
if hex:len() == 3 then
return (tonumber("0x"..hex:sub(1,1))*17)/255, (tonumber("0x"..hex:sub(2,2))*17)/255, (tonumber("0x"..hex:sub(3,3))*17)/255
else
return tonumber("0x"..hex:sub(1,2))/255, tonumber("0x"..hex:sub(3,4))/255, tonumber("0x"..hex:sub(5,6))/255
end
end