Skip to content

Instantly share code, notes, and snippets.

View joaocunha's full-sized avatar
Web Performance

João Cunha joaocunha

Web Performance
View GitHub Profile
@joaocunha
joaocunha / How To Hide The Select Arrow On Firefox.md
Last active December 10, 2023 13:05
How to hide <select> dropdown's arrow in Firefox when using "-moz-appearance: none;".

This is no longer a bug. I'm keeping the gist for historical reasons, as it helped to get it fixed. Make sure to read the notes by the end of the post.

How to remove hide the select arrow in Firefox using -moz-appearance:none;

TL;DR (or, the fix)

  1. Set -moz-appearance to none. This will "reset" the styling of the element;
  2. Set text-indent to 0.01px. This will "push" the text a tiny bit[1] to the right;
@joaocunha
joaocunha / console-log.sublime-snippet
Last active December 28, 2015 16:08
Sublime Text Snippet - console.log()
<snippet>
<content><![CDATA[console.log($SELECTION$0);]]></content>
<tabTrigger>clog</tabTrigger>
<scope>text.html,source.js</scope>
<description>console.log()</description>
</snippet>
@joaocunha
joaocunha / console-time.sublime-snippet
Last active December 28, 2015 16:08
Sublime Text Snippet - console.time()
<snippet>
<content><![CDATA[
console.time(${1:'timer'});
$SELECTION$0
console.timeEnd(${2:'timer'});
]]></content>
<tabTrigger>ctime</tabTrigger>
<scope>text.html,source.js</scope>
<description>console.time()</description>
@joaocunha
joaocunha / sublime-text-paste-indent-shortcut.json
Last active December 28, 2015 16:09
Sublime Text Paste & Indent Shortcut
// Replaces pasting with paste and indent.
// Add to [Preferences → Key Bindings - User] file
// MAC
{ "keys": ["super+v"], "command": "paste_and_indent"},
{ "keys": ["super+shift+v"], "command": "paste" }
// Windows/Linux
{ "keys": ["ctrl+v"], "command": "paste_and_indent"},
{ "keys": ["ctrl+shift+v"], "command": "paste" }
@joaocunha
joaocunha / modernizr-retina-test.js
Created November 27, 2013 13:46
Modernizr test for retina / high resolution / high pixel density.
/**
* Modernizr test for retina / high resolution / high pixel density
*
* @author Joao Cunha
* @license MIT
*/
Modernizr.addTest('hires', function() {
// starts with default value for modern browsers
var dpr = window.devicePixelRatio ||
@joaocunha
joaocunha / modernizr-multipleupload-test.js
Created February 4, 2014 05:14
Modernizr test for multiple file upload capabilities
/**
* Modernizr test for multiple file upload capabilities
*
* @author Joao Cunha
* @license MIT
*/
Modernizr.addTest('multipleupload', function() {
return 'multiple' in document.createElement('input');
});
@joaocunha
joaocunha / Simple feature detection for :checked pseudo-selector.md
Last active August 29, 2015 13:56
Simple feature detection for :checked pseudo-selector

If you have ever accessibly styled a checkbox/radio button using the :checked pseudo-selector, you know that IE8- don't support it. We usually have two options: either a custom Modernizr test or either a conditional IE class.

There's a simpler way to detect it and it doesn't rely on anything external:

/* hide the default element only on browsers that support :checked */
input:checked, input:not(checked) {
    display: none;
}
 
cd ~
sudo apt-get update
sudo apt-get install openjdk-7-jre-headless -y
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch and replace wget link below
# NEW WAY / EASY WAY
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.0.1.deb
sudo dpkg -i elasticsearch-1.0.1.deb
@joaocunha
joaocunha / code-smell.md
Last active August 29, 2015 14:06 — forked from gvn/code-smell.md

Eliminating Code Smell With Grunt

by Gavin Lazar Suntop @gvn

Intro

I love clean code. There, I said it. I pride myself on passing strict linting standards and keeping my code easy to read. It's not just a personal proclivity, but a choice I hope benefits other developers.

My general experience with teams has been that code style is something people care about and have strong personal preferences. Typically, at some point people get tired of dealing with inconsistency and a standardization meeting is called. This is, of course, an important discussion to have. The problem that tends to occur is either lack of documentation or lack of enforcement of the agreed upon style. Additionally, new team members or contributors may not have access to a clear set of rules.

@joaocunha
joaocunha / .jscsrc
Created December 1, 2014 01:30
My defaults for JSCS
{
"fileExtensions": [
".js"
],
"disallowDanglingUnderscores": {
"allExcept": ["_exception"]
},
"disallowEmptyBlocks": true,
"disallowFunctionDeclarations": true,
"disallowKeywords": [ "with", "eval" ],