This repository has been archived by the owner on Jul 4, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
57 changed files
with
2,748 additions
and
1 deletion.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--- | ||
date: '2013-01-07' | ||
title: Easily make favicon.ico | ||
layout: simple | ||
tags: [Development] | ||
description: Never look for a favicon generator again. | ||
--- | ||
|
||
### | ||
|
||
<!-- {.-literate-style} --> | ||
|
||
To create `favicon.ico`, you don't need anything other than ImageMagick. | ||
|
||
```bash | ||
brew install imagemagick | ||
sudo apt-get install imagemagick | ||
``` | ||
|
||
### Creating icon files | ||
|
||
<!-- {.-literate-style} --> | ||
|
||
Use it to convert `.png`'s into `.ico` (use 32px and 16px sizes for retina compatibility). | ||
|
||
``` | ||
convert favicon-32.png favicon-16.png favicon.ico | ||
``` | ||
|
||
### Resizing icons | ||
|
||
<!-- {.-literate-style} --> | ||
|
||
You can even use it to generate a 16px version from a 32px: | ||
|
||
``` | ||
convert favicon-32.png -resize 16x16 favicon16.png | ||
``` |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
--- | ||
date: '2013-11-27' | ||
title: Get started with Ansible in 2 minutes | ||
tags: [Development, Ansible] | ||
description: Provisioning servers is easy using Ansible. Here's a guide to set it up from scratch. | ||
--- | ||
|
||
[Ansible](http://ansible.com) is a fantastic tool for provisioning servers. I personally prefer it over Chef, Puppet and Salt. Here's how to get an Ansible project started. | ||
|
||
## Install Ansible | ||
|
||
Ansible is officially available via `pip`. | ||
|
||
```sh | ||
brew install ansible # OSX | ||
[sudo] pip install ansible # elsewhere | ||
``` | ||
|
||
<!-- {.-terminal} --> | ||
|
||
## Start your project | ||
|
||
Make the directory. Put this under version control, preferrably. | ||
|
||
```sh | ||
~$ mkdir setup | ||
~$ cd setup | ||
``` | ||
|
||
<!-- {.-terminal} --> | ||
|
||
## Create an inventory file | ||
|
||
This is a list of hosts you want to manage, grouped into groups. (Hint: try | ||
using 127.0.0.1 to deploy to your local machine) | ||
|
||
```dosini | ||
# ~/setup/hosts | ||
|
||
[sites] | ||
127.0.0.1 | ||
192.168.0.1 | ||
192.168.0.2 | ||
192.168.0.3 | ||
``` | ||
|
||
## Create your first Playbook | ||
|
||
A playbook is just a YAML file. | ||
|
||
```yaml | ||
# ~/setup/playbook.yml | ||
|
||
- hosts: 127.0.0.1 | ||
user: root | ||
tasks: | ||
- name: install nginx | ||
apt: pkg=nginx state=present | ||
|
||
- name: start nginx every bootup | ||
service: name=nginx state=started enabled=yes | ||
|
||
- name: do something in the shell | ||
shell: echo hello > /tmp/abc.txt | ||
|
||
- name: install bundler | ||
gem: name=bundler state=latest | ||
``` | ||
|
||
## Run it | ||
|
||
Use the `ansible-playbook` command. | ||
|
||
```sh | ||
~/setup$ ls | ||
hosts | ||
playbook.yml | ||
``` | ||
|
||
<!-- {.-terminal} --> | ||
|
||
```sh | ||
~/setup$ ansible-playbook -i hosts playbook.yml | ||
PLAY [all] ******************************************************************** | ||
|
||
GATHERING FACTS *************************************************************** | ||
ok: [127.0.0.1] | ||
|
||
TASK: [install nginx] ********************************************************* | ||
ok: [127.0.0.1] | ||
|
||
TASK: [start nginx every bootup] ********************************************** | ||
ok: [127.0.0.1] | ||
... | ||
``` | ||
|
||
<!-- {.-wide} --> | ||
|
||
## Further reading | ||
|
||
Ansible's source is available via GitHub: [ansible/ansible](https://github.com/ansible/ansible). | ||
|
||
- [Getting Started With Ansible](http://lowendbox.com/blog/getting-started-with-ansible/) (lowendbox.com) | ||
- [Ansible Documentation](http://docs.ansible.com/modules.html) (ansible.com) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
date: '2015-06-06' | ||
title: Alfred color schemes | ||
description: Here's my nice color scheme for Alfred. | ||
tags: [MacOS] | ||
attachments: | ||
- ./alfred-color-schemes/alfred-dark.png | ||
--- | ||
|
||
<figure class='-panorama'> | ||
<img src='./alfred-color-schemes/alfred-dark.png' /> | ||
</figure> | ||
|
||
Today I learned you can change colors in [Alfred]. [Here's mine.][color] | ||
|
||
[alfred]: http://alfredapp.com | ||
[color]: alfred://theme/searchForegroundColor=rgba(255,255,255,1.00)&resultSubtextFontSize=1&searchSelectionForegroundColor=rgba(0,0,0,1.00)&separatorColor=rgba(0,0,0,0.00)&resultSelectedBackgroundColor=rgba(22,9,7,0.25)&shortcutColor=rgba(76,76,76,1.00)&scrollbarColor=rgba(38,38,38,1.00)&imageStyle=8&resultSubtextFont=Helvetica%20Neue%20Light&background=rgba(30,31,49,0.84)&shortcutFontSize=2&searchFontSize=3&resultSubtextColor=rgba(127,127,127,1.00)&searchBackgroundColor=rgba(0,0,0,0.00)&name=OSX%20Yosemite%20Dark%20%2B&resultTextFontSize=2&resultSelectedSubtextColor=rgba(186,186,186,1.00)&shortcutSelectedColor=rgba(127,127,127,1.00)&widthSize=2&border=rgba(4,19,37,0.00)&resultTextFont=Helvetica%20Neue%20Light&resultTextColor=rgba(255,255,255,1.00)&cornerRoundness=3&searchFont=Helvetica%20Neue%20Light&searchPaddingSize=0&credits=&searchSelectionBackgroundColor=rgba(178,215,255,1.00)&resultSelectedTextColor=rgba(255,255,255,1.00)&resultPaddingSize=2&shortcutFont=Helvetica%20Neue%20Light |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--- | ||
date: '2015-05-26' | ||
title: Babel class inheritance in Internet Explorer | ||
tags: [JavaScript] | ||
description: IE doesn't support class inheritance in Babel. Here's a way to fix that. | ||
outdated: | | ||
This post was written for Babel version 5. Also, this post is made for supporting IE8, a version which has very negligible use in 2019. | ||
--- | ||
|
||
```js | ||
class Circle extends Shape { | ||
getArea() { | ||
return this.radius * Math.PI * 2 | ||
} | ||
} | ||
``` | ||
|
||
### Class inheritance caveats | ||
|
||
When using class inheritance with Babel.js, keep in mind that IE10 and below are [not supported](http://babeljs.io/docs/advanced/caveats) by default. Babel's class inheritance relies on \_\_\_proto\_\_\_ which is not available on legacy IE versions. | ||
|
||
Using _super_ is also not supported on IE8 and below, as it compiles down to using [Object.getPrototypeOf](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getPrototypeOf). | ||
|
||
To get around these caveats, use the [protoToAssign](http://babeljs.io/docs/advanced/transformers/spec/proto-to-assign/) transformer to make inheritance work, along with loose mode on classes to enable support for `super`. | ||
|
||
```bash | ||
babel --optional spec.protoToAssign --loose es6.classes script.js | ||
``` |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
--- | ||
date: '2015-03-05' | ||
title: Using ligatures in CSS | ||
tags: [CSS] | ||
description: Implement fancy typographic ligatures with just CSS... no images required | ||
layout: simple | ||
attachments: | ||
- './css-ligatures/ligatures.png' | ||
--- | ||
|
||
Headings can benefit from nice ligatures. Use the [font-feature-settings](https://developer.mozilla.org/en-US/docs/Web/CSS/font-feature-settings) CSS property to enable these OpenType features. Here's a snippet to start you with: | ||
|
||
```css | ||
.headings { | ||
/* don't display digraphs in languages that don't support it */ | ||
font-language-override: normal; | ||
|
||
/* use font-defined kerning info */ | ||
font-kerning: auto; | ||
|
||
/* opentype options: kerning, ligatures, horiz ligatures, | ||
* discretionary ligatures, contextual swash */ | ||
font-feature-settings: 'kern', 'liga', 'dlig', 'hlig', 'cswh'; | ||
|
||
/* allow browser to auto-infer missing glyphs */ | ||
font-synthesis: weight style; | ||
} | ||
``` | ||
|
||
### Example | ||
|
||
<!-- {.-literate-style} --> | ||
|
||
Here is what they would look like with EB Garamond. Be sure to also check [List of OpenType features](http://en.wikipedia.org/wiki/List_of_typographic_features) for more features you can use. | ||
|
||
<figure> | ||
<img src='./css-ligatures/ligatures.png' /> | ||
</figure> | ||
|
||
## Use brick.im | ||
|
||
Fonts from Typekit and Google Web Fonts may be stripped of all these extra OpenType information. Use fonts from [brick.im](http://brick.im/) instead. | ||
|
||
## Swashes | ||
|
||
First letters can look good with swashes (eg, an `R` with an extra long stem). Just be sure to turn this on on a as-needed basis since it may overlap with the rest of the text. | ||
|
||
```css | ||
.headings:first-letter { | ||
font-feature-settings: 'kern', 'swsh'; | ||
} | ||
``` | ||
|
||
## Disabling ligatures | ||
|
||
You can turn off ligatures using `font-feature-settings`. | ||
|
||
```css | ||
font-feature-settings: 'liga' 0; | ||
``` |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--- | ||
date: '2015-03-03' | ||
layout: simple | ||
title: Easy color computations using Sass & Stylus CLI | ||
tags: [CSS, Sass] | ||
description: Need to lighten or darken colors easily from the command line? Here's how you can do it with Sass or Stylus. | ||
--- | ||
|
||
**Use [stylus]'s CLI for easy color computations.** Stylus CLI is faster than Sass and has shorter syntax for color computations. | ||
|
||
```bash | ||
$ npm i -g stylus | ||
$ stylus -i | ||
``` | ||
|
||
Here's _lighten_ and _hue shift_: | ||
|
||
``` | ||
> #aaa + 10% | ||
=> #b2b2b2 | ||
|
||
> #ff0 - 10deg | ||
=> #ffd500 | ||
``` | ||
|
||
### One-liner version | ||
|
||
<!-- {.-literate-style} --> | ||
|
||
Not quite as elegant, but it can be useful. | ||
|
||
```bash | ||
echo "*{a: #ff0 - 10deg}" | stylus -p | ||
* { a: #ffd500; } | ||
``` | ||
|
||
### Using Sass | ||
|
||
<!-- {.-literate-style} --> | ||
|
||
If you need Sass for some reason, it also takes `-i`. | ||
|
||
```sh | ||
$ gem install sass | ||
$ sass -i | ||
>> darken(red, 10%) | ||
#cc0000 | ||
``` | ||
|
||
[stylus]: http://learnboost.github.io/stylus |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- | ||
date: '2015-02-25' | ||
title: ES6 class pitfalls | ||
tags: [JavaScript] | ||
description: Keep aware of this one caveat when making classes in ES6. | ||
--- | ||
|
||
```js | ||
class Shape { | ||
get area() { | ||
return this.width * this.height | ||
} | ||
} | ||
``` | ||
|
||
<!-- {.-wide} --> | ||
|
||
### Decorated functions | ||
|
||
<!-- {.-literate-style} --> | ||
|
||
ES6 makes it easy to define classes, but you can't have decorated functions. For that, you'll still need to drop to using `prototype`. | ||
|
||
```js | ||
Shape.prototype.iterate = memoize(function () { | ||
... | ||
}) | ||
``` | ||
|
||
### Non-method attributes | ||
|
||
<!-- {.-literate-style} --> | ||
|
||
Same with non-method attributes. | ||
|
||
```js | ||
Shape.prototype.template = require('fs').readFileSync( | ||
'./template.html', | ||
'utf-8' | ||
) | ||
``` |
Oops, something went wrong.