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 / 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" ],
@joaocunha
joaocunha / .jshintrc.js
Last active August 29, 2015 14:10 — forked from connor/.jshintrc.js
// NOTE: I added the .js extension to this gist so it would have syntax highlighting. This file should have NO file extension
{
// Settings
"passfail" : false, // Stop on first error.
"maxerr" : 100, // Maximum error before stopping.
// Predefined globals whom JSHint will ignore.
"browser" : true, // Standard browser globals e.g. `window`, `document`.
@joaocunha
joaocunha / pre-commit
Last active August 29, 2015 14:10 — forked from Simbul/pre-commit
#!/usr/bin/env ruby
# This pre-commit hook will prevent any commit to forbidden branches
# (by default, "staging" and "production").
# Put this file in your local repo, in the .git/hooks folder
# and make sure it is executable.
# The name of the file *must* be "pre-commit" for Git to pick it up.
FORBIDDEN_BRANCHES = ["staging", "production"]
@joaocunha
joaocunha / pre-commit
Last active August 29, 2015 14:10 — forked from iamdustan/pre-commit
#!/bin/bash
# Prevent commits against the 'master' branch
if [[ `git rev-parse --abbrev-ref HEAD` == 'master' ]]
then
echo 'You cannot commit to the master branch!'
echo 'Stash your changes and apply them to another branch, using:'
echo 'git stash'
echo 'git checkout <branch>'
echo 'git stash apply'
@joaocunha
joaocunha / vars.styl
Created December 11, 2014 22:09
Stylus Vars used on the MDN Kuma project
/* vendors */
/* - this is a global variable set by stylus to 'moz webkit o ms official' by default
- as far as I can tell it only uses it for @keyframes
- and they're going to remove it in 1.0
- anyway, we get csslint errors if ms is in this list
*/
vendors = webkit official;
/* our custom variable for prefixing */
VENDOR-PREFIXES = '-webkit-' '-moz-' '-ms-';
/* custom list of properties and their valid prefixes for vendors we support */
#!/bin/sh
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
@joaocunha
joaocunha / makeapp.sh
Last active August 29, 2015 14:14 — forked from eerne/makeapp.sh
#!/bin/sh
echo "What should the Application be called (no spaces allowed e.g. GCal)?"
read inputline
name="$inputline"
echo "What is the url (e.g. https://www.google.com/calendar/render)?"
read inputline
url="$inputline"