Skip to content

Instantly share code, notes, and snippets.

View lcdsantos's full-sized avatar
🏠
Working from home

Leonardo Santos lcdsantos

🏠
Working from home
View GitHub Profile
@lcdsantos
lcdsantos / gist:a9b273e012b9c541262b
Created April 28, 2015 16:32
Get missing parameters from triangle
// http://www.nayuki.io/page/triangle-solver-javascript
function calcTriangle(angleA, angleB, angleC, sideA, sideB, sideC) {
if (angleA == null) angleA = 180 - angleB - angleC;
if (angleB == null) angleB = 180 - angleC - angleA;
if (angleC == null) angleC = 180 - angleA - angleB;
if (angleA <= 0 || angleB <= 0 || angleC <= 0)
throw status + " - No solution";
var sinA = Math.sin(degToRad(angleA)),
/*
* Easing Functions - inspired from http://gizma.com/easing/
* only considering the t value for the range [0, 1] => [0, 1]
*/
EasingFunctions = {
// no easing, no acceleration
linear: function (t) { return t },
// accelerating from zero velocity
easeInQuad: function (t) { return t*t },
// decelerating to zero velocity
@lcdsantos
lcdsantos / presets
Last active March 31, 2016 06:31
Firefox Dev Tools Responsive Design View Presets
  1. Open a new Firefox tab or window, and type about:config (If a warning message comes up, just click OK).

  2. Create a new entry devtools.responsiveUI.presets - right click and chose 'new' then 'string' - under enter the preference name type devtools.responsiveUI.presets then hit OK. When the enter string box appears simply add the presets.

  3. Restart Firefox.

Obs: It's devtools.responsiveUI.presets, not devtools.responsive.UI.presets.

@lcdsantos
lcdsantos / Default (Windows).sublime-keymap
Last active September 2, 2016 16:22
Sublime Text Keyboard shortcuts
[
{
"keys": [
"ctrl+v"
],
"command": "paste_and_indent"
},
{
"keys": [
"ctrl+shift+v"
@lcdsantos
lcdsantos / Preferences.sublime-settings
Last active September 14, 2016 12:11
Sublime Text User config
{
"always_show_minimap_viewport": true,
"atomic_save": false,
"binary_file_patterns":
[
"node_modules/*"
],
"bold_folder_labels": true,
"caret_style": "smooth",
"color_scheme": "Packages/Material Theme/schemes/Material-Theme-Darker.tmTheme",
@lcdsantos
lcdsantos / email-template.html
Created September 14, 2016 18:33
HTML E-mail template
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>E-mail</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
#outlook a {
padding: 0;
@lcdsantos
lcdsantos / .editorconfig
Created September 14, 2016 18:38
My root EditorConfig file
# EditorConfig is awesome: http://EditorConfig.org
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
trim_trailing_whitespace = true
@lcdsantos
lcdsantos / Copy text directly from Photoshop text layer.
Created December 2, 2016 02:04 — forked from praveenvijayan/Copy text directly from Photoshop text layer.
Copy text directly from text layer. Works above photoshop cs6. Copy following script file into /Applications/Adobe Photoshop CC 2014/Presets/Scripts (MAC) or C:\Program Files\Adobe\Adobe Photoshop CC 2014\Presets\Scripts (WIN). Assign shortcut for easy access (cmd+option+c / ctrl+alt+c)
/*****************************************************************
*
* Copy Layer text 1.0 - by Praveen Vijayan! - http://www.decodize.com/
*
* Compatibility above Photoshop CS6
*
* Licensed under the Creative Commons Attribution 2.5 License - http://creativecommons.org/licenses/by/2.5/
*
*****************************************************************/
/*! Custom Input File v1.0 - Copyright (c) 2016 Leonardo Santos */
(function($) {
$.fn.inputFile = function() {
return this.each(function() {
var $this = $(this);
$this
.on('change', function() {
var value = /[^(\\|\/)]*$/.exec($this.val());
$this.siblings('span').text(value[0]);
})
@lcdsantos
lcdsantos / leaflet-big-image-full.html
Created December 13, 2016 16:33 — forked from longhotsummer/leaflet-big-image-full.html
Full example of using leaflet to pan and zoom a big image, as described at http://kempe.net/blog/2014/06/14/leaflet-pan-zoom-image.html
<html>
<!-- See also: http://kempe.net/blog/2014/06/14/leaflet-pan-zoom-image.html -->
<head>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css"></script>
<style>
#image-map {
width: 100%;
height: 300px;
border: 1px solid #ccc;
margin-bottom: 10px;