Skip to content

Instantly share code, notes, and snippets.

Avatar
✍️
Coding

Wesley Luyten luwes

✍️
Coding
View GitHub Profile
@luwes
luwes / cloudSettings
Last active Dec 19, 2019
Visual Studio Code Settings Sync Gist
View cloudSettings
{"lastUpload":"2019-12-19T22:38:50.273Z","extensionVersion":"v3.4.3"}
View keybase.md

Keybase proof

I hereby claim:

  • I am luwes on github.
  • I am luwes (https://keybase.io/luwes) on keybase.
  • I have a public key ASDE6Oaedhz1Ud4ltpbKU0z19dFw1ubiJRxvsg_xqs4nsQo

To claim this, I am signing this object:

@luwes
luwes / tagref.js
Created Mar 24, 2019
Static variable tag names for lit-html, lighterhtml, etc...
View tagref.js
import { html } from 'lit-html';
const superhtml = tagRef(html)
const result = superhtml`<${MyComponent}>Woohoo</${MyComponent}>`;
export function tagRef(html) {
const cache = new WeakMap();
return (s, ...e) => {
const tagIndex = (t, i) =>
// checks for '*<' or '*</' and a valid tagname
View rollup-plugin-load-plugins.js
/* eslint-env node */
const fs = require('fs');
const path = require('path');
const camelCase = require('lodash/camelcase');
const pkg = require(path.resolve('package.json'));
const defaultOptions = {
regex: /^rollup-plugin-/,
path: './'
};
@luwes
luwes / redux-proxy-selectors.js
Created Dec 26, 2017
Experiment to add selectors to state as getters
View redux-proxy-selectors.js
/**
The selectors would be a map e.g.
const selectors = {
ui: {
getDoubleBurgers: (state) => state.ui.burger + state.ui.burger
}
}
@luwes
luwes / rollup.js
Created Sep 7, 2017
Rollup library script - JavaScript API
View rollup.js
/* eslint-env node */
const fs = require('fs');
const uglifyJs = require('uglify-js');
const chalk = require('chalk');
const maxmin = require('maxmin');
const rollup = require('rollup');
const babelrc = require('babelrc-rollup').default;
const babel = require('rollup-plugin-babel');
const nodeResolve = require('rollup-plugin-node-resolve');
@luwes
luwes / main.py
Last active Sep 27, 2016
Tornado Vimeo Mixin OAuth2
View main.py
class BaseHandler(RequestHandler):
COOKIE_NAME = 'user'
def get_current_user(self):
user_json = self.get_secure_cookie(self.COOKIE_NAME)
if not user_json:
return None
return json_decode(user_json)
class LoginHandler(BaseHandler, VimeoMixin):
View dreamhost_python_setup.sh
#!/usr/bin/env bash
# Written by William Ting for the following blog post:
# http://williamting.com/posts/2012/04/18/set-up-python-and-django-on-dreamhost/
rcfile="${HOME}/.bashrc"
version="2.7.8"
setuptools_version="2.7"
tmp_dir="${HOME}/tmp-${RANDOM}"
if [[ ${#} == 0 ]]; then
View _mixins.scss
@mixin prefixed($property, $value) {
@each $prefix in "-webkit-", "-moz-", "-ms-", "-o-", "" {
#{$prefix}#{$property}: #{$value};
}
}
@mixin transition($props) {
@include prefixed('transition', $props);
}
View populate.js
String.prototype.populate = function(obj, funcs) {
return this.replace(/\{\{\s*([^|\s}]+)\|?([^\s}]*)\s*\}\}/g, function(match, key, mods) {
var str = obj[key];
if (typeof str !== "undefined") {
if (funcs && mods) {
var arr = mods.split('|');
for (var i = 0; i < arr.length; i++) {
var mod = arr[i].split(':')[0];
var par = arr[i].split(':')[1];
var args = par ? par.split(',') : [];