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
let svgMimeType = 'image/svg+xml' | |
let svgNS = 'http://www.w3.org/2000/svg' | |
let preamble = '<?xml version="1.0" encoding="utf-8"?>' | |
Object.assign(document.createElement('input'), { | |
type: 'file', | |
accept: svgMimeType, | |
multiple: true, | |
onchange: processFiles, |
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
from time import time | |
def fib(x): | |
if x in (0, 1): | |
return x | |
fib1 = 0 | |
fib2 = 1 | |
current = 1 |
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
# Taken from http://www.alexeyshmalko.com/2014/using-vim-as-c-cpp-ide/ | |
set tabstop=4 | |
set softtabstop=4 | |
set shiftwidth=4 | |
set noexpandtab | |
augroup project | |
autocmd! | |
autocmd BufRead,BufNewFile *.h,*.c set filetype=c.doxygen |
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
const emailRe = /^([\w\d\-+](\.?[\w\d_\-+])*)@(((2([0-4]\d|5[0-5])|1?\d{1,2})\.){3}(2([0-4]\d|5[0-5])|1?\d{1,2})|[a-z\d]([a-z\d-]{1,61}[a-z\d])?(?:\.[a-z]{2,})+)$/ | |
// Able to pass the test samples here: https://blogs.msdn.microsoft.com/testing123/2009/02/06/email-address-test-cases/ |
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
function reduce(transform, append, arr, init) { | |
const l = arr.length | |
let i = 0 | |
let accum = init | |
if (typeof accum === 'undefined') { | |
accum = arr[0] | |
i = 1 | |
} | |
for (; i < l; i++) { | |
accum = append(accum, transform(arr[i])) |
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
import Vue from 'vue' | |
import { Component, Prop } from 'vue-property-decorator' | |
import Imba from 'imba' | |
/** | |
import { App } from './App.imba' | |
import ImbaAdapter from './ImbaAdapter' | |
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
license: mit |
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
const h = (tag, attrs, ...children) => { | |
const elm = document.createElement(tag) | |
for (let key in attrs) { | |
if (key.slice(0, 2) == 'on') { | |
const evtName = key.slice(2) | |
const cb = attrs[key] | |
if (cb == null) continue // we can use null or undefnied to suppress | |
elm.addEventListener(evtName, cb) | |
} else if (['disabled', 'autocomplete', 'selected', 'checked'].indexOf(key) > -1) { | |
if (attrs[key]) { |
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
/** | |
* (c) 2017 Hajime Yamasaki Vukelic | |
* Some rights reserved. | |
* | |
* yarn add -D webpack webpack-dev-server ts-node ts-loader html-webpack-plugin @types/webpack @types/html-webpack-plugin | |
*/ | |
import path = require("path"); | |
import HTMLWebpackPlugin = require("html-webpack-plugin"); |
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
// I'm not the original author of this code. Please let me | |
// know if you know/find the original author so I can fully | |
// attribute. | |
import Vue, { VNode } from "vue"; | |
declare global { | |
namespace JSX { | |
interface Element extends VNode {} | |
interface ElementClass extends Vue {} |
NewerOlder