Skip to content

Instantly share code, notes, and snippets.

✍️
Coding

wesley luyten luwes

✍️
Coding
Block or report user

Report or block luwes

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@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(',') : [];
@luwes
luwes / sub.js
Last active Dec 23, 2015
Sub JavaScript library Very limited substitute for jQuery to include in small projects so you have no dependencies Browser support IE8+
View sub.js
/**
* Sub JavaScript library v0.2
* Very limited substitute for jQuery to include
* in small projects so you have no dependencies
* Browser support IE8+
*
* Includes code snippets from
* http://jquery.com/
* http://underscorejs.org/
*
You can’t perform that action at this time.