- Go to Digital Ocean
- Create new ubuntu droplet
<!DOCTYPE html> | |
<!-- | |
This is a simple experiment relying on ECMAScript 6 Proxies. To try this out, | |
use Aurora (http://www.mozilla.org/en-US/firefox/channel/). | |
The goal was to create a HTML writer where the method names were really just | |
the HTML tags names, but without manually creating each method. This uses | |
a Proxy to create a shell to an underlying writer object that checks each | |
method name to see if it's in a list of known tags. |
<% # app/views/layouts/admin.html.erb %> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Admin Interface</title> | |
<%= csrf_meta_tags %> | |
<% # Optionally use admin-specific assets here instead of the normal application assets %> | |
<%= stylesheet_link_tag 'admin', media: 'all', 'data-turbolinks-track': 'reload' %> |
It's a common confusion about terminal colours... Actually we have this:
- plain ascii
- ansi escape codes (16 colour codes with bold/italic and background)
- 256 colour palette (216 colours + 16 ansi + 24 gray) (colors are 24bit)
- 24bit true colour ("888" colours (aka 16 milion))
printf "\x1b[${bg};2;${red};${green};${blue}m\n"
All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.
elem.offsetLeft
,elem.offsetTop
,elem.offsetWidth
,elem.offsetHeight
,elem.offsetParent
elem.clientLeft
,elem.clientTop
,elem.clientWidth
,elem.clientHeight
elem.getClientRects()
,elem.getBoundingClientRect()
This is an example of how to use the Google Drive file picker and Google Drive API to retrieve files from Google Drive using pure JavaScript. At the time of writing (14th July 2013), Google have good examples for using these two APIs separately, but no documentation on using them together.
Note that this is just sample code, designed to be concise to demonstrate the API. In a production environment, you should include more error handling.
See a demo at http://stuff.dan.cx/js/filepicker/google/
I used to use NERD tree for quite a while, then switched to CtrlP for something a little more lightweight. My setup now includes zero file browser or tree view, and instead uses native Vim fuzzy search and auto-directory switching.
There is a super sweet feature in Vim whereby you can fuzzy find your files using **/*
, e.g.:
:vs **/*<partial file name><Tab>
// Initialization | |
const webpack = require('webpack'); | |
const HtmlWebpackPlugin = require('html-webpack-plugin'); | |
const CopyWebpackPlugin = require('copy-webpack-plugin'); | |
const postcssImport = require('postcss-easy-import'); | |
const BrowserSyncPlugin = require('browser-sync-webpack-plugin'); | |
const path = require('path'); | |
const StyleLintPlugin = require('stylelint-webpack-plugin'); | |
const APP = path.join(__dirname, 'app'); |
/* bling.js */ | |
window.$ = document.querySelectorAll.bind(document); | |
Node.prototype.on = window.on = function (name, fn) { | |
this.addEventListener(name, fn); | |
} | |
NodeList.prototype.__proto__ = Array.prototype; |
import { Strategy as FacebookStrategy } from 'passport-facebook'; | |
import db from 'api/db'; | |
const { User, Auth } = db.App; | |
export async function facebookPassportCallback(req, accessToken, refreshToken, profile, done) { | |
try { | |
const [auth, created] = await Auth.findOrCreate({ | |
where: { | |
provider: profile.provider, |