Skip to content

Instantly share code, notes, and snippets.

View jameslutley's full-sized avatar
🎯
Focusing

James Lutley jameslutley

🎯
Focusing
View GitHub Profile
@jameslutley
jameslutley / up-and-running-with-edeliver-on-do.md
Created June 23, 2018 03:49 — forked from davoclavo/up-and-running-with-edeliver-on-do.md
Getting Elixir / Phoenix running on Digital Ocean with edeliver

Build Server

  • Go to Digital Ocean
  • Create new ubuntu droplet

Setup Server

@jameslutley
jameslutley / es6proxy.htm
Created June 12, 2018 17:50 — forked from nzakas/es6proxy.htm
Example of ES6 Proxy
<!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.
@jameslutley
jameslutley / admin.html.erb
Created June 12, 2018 04:51 — forked from carlosramireziii/admin.html.erb
"Best Practices For Building A Rails Admin Interface From Scratch" sample setup
<% # 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' %>
@jameslutley
jameslutley / TrueColour.md
Created June 5, 2018 17:07 — forked from XVilka/TrueColour.md
True Colour (16 million colours) support in various terminal applications and terminals

Colours in terminal

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"
@jameslutley
jameslutley / what-forces-layout.md
Created January 25, 2018 00:47 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

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.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
@jameslutley
jameslutley / 1_README.md
Created December 22, 2017 04:04 — forked from Daniel15/1_README.md
Complete Google Drive File Picker example

Google Drive File Picker Example

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/

@jameslutley
jameslutley / README.md
Created November 22, 2017 07:07 — forked from csswizardry/README.md
Vim without NERD tree or CtrlP

Vim without NERD tree or CtrlP

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.

Fuzzy Search

There is a super sweet feature in Vim whereby you can fuzzy find your files using **/*, e.g.:

:vs **/*<partial file name><Tab>
@jameslutley
jameslutley / webpack.lint.config.js
Created September 6, 2017 04:48 — forked from manavsehgal/webpack.lint.config.js
Webpack configuration for running Browsersync, ESLint and StyleLint along with Hot Reloading
// 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');
@jameslutley
jameslutley / bling.js
Created August 26, 2017 14:49 — forked from paulirish/bling.js
bling dot js
/* bling.js */
window.$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
}
NodeList.prototype.__proto__ = Array.prototype;
@jameslutley
jameslutley / passport-facebook-asyn-await.js
Created August 23, 2017 07:22
Promise vs. async/await
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,