This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const webpackMerge = require("webpack-merge"); | |
const applyPresets = (env = { presets: [] }) => { | |
const presets = env.presets || []; | |
/** @type {string[]} */ | |
const mergedPresets = [].concat(...[presets]); | |
const mergedConfigs = mergedPresets.map(presetName => require(`./presets/webpack.${presetName}`)(env)); | |
return webpackMerge({}, ...mergedConfigs); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ git status | |
5 commits pending | |
$ git reset --soft HEAD~5 # where 5 is the number of commits you saw in the `git status` | |
$ git stash |
Because pointers can be ugh
To understand a pointer, let's review "regular" variables first. If you're familiar with a programming language without pointers like JavaScript, this is what you think when you hear "variable".
When declaring a variable by identifier (or name), the variable is synonymous with its value.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// find all elements with a z-index and indicate what they are. | |
// uses css outline which is not supported in IE <8 | |
function contrast(color){ return '#' + | |
(Number('0x'+color.substr(1)).toString(10) > 0xffffff/2 ? '000000' : 'ffffff'); | |
} | |
jQuery('*') | |
.filter(function(){ return $(this).css('zIndex') !== 'auto'; }) | |
.each(function(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { FieldProps } from 'formik' | |
import React from 'react' | |
import Select, { Option, ReactSelectProps } from 'react-select' | |
export const SelectField: React.SFC<ReactSelectProps & FieldProps> = ({ | |
options, | |
field, | |
form, | |
}) => ( | |
<Select |
- CSS Sprites - http://css-tricks.com/css-sprites/
- Put CSS at the top of your page
- Reduce number of HTTP requests
- Use a CDN
- Expires/cache-control header
- Specify character set UTF-8 meta tag
- Minify HTML, CSS, and JS (Grunt!) - https://github.com/gruntjs/grunt-contrib-uglify, https://github.com/gruntjs/grunt-contrib-cssmin, and https://github.com/gruntjs/grunt-contrib-htmlmin
- Concatenate CSS and JS (Grunt!) - https://github.com/gruntjs/grunt-contrib-concat
- Enable GZip compression - http://betterexplained.com/articles/how-to-optimize-your-site-with-gzip-compression/
- Use efficient CSS selectors (mainly, don't use too many) - http://csswizardry.com/2011/09/writing-efficient-css-selectors/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Box Shadow</title> | |
<style> | |
.box { | |
height: 150px; | |
width: 300px; | |
margin: 20px; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// It is important to declare your variables. | |
(function() { | |
var foo = 'Hello, world!'; | |
print(foo); //=> Hello, world! | |
})(); | |
// Because if you don't, the become global variables. | |
(function() { |
OlderNewer