Skip to content

Instantly share code, notes, and snippets.

View 13protons's full-sized avatar

Alan Languirand 13protons

View GitHub Profile
@13protons
13protons / VueDarkMode.js
Last active March 11, 2021 20:43
Vue 2.x plugin to detect dark mode and make a reactive property describing the current mode available to all components of your app
export default function Plugin(Vue) {
/**
Installing in your app root:
import DarkMode from './path/to/this/code.js';
Vue.use(DarkMode);
Usage in your components:
<div v-if="$darkMode.isDark">...</div>
@13protons
13protons / unitTesting.md
Last active October 17, 2022 06:15
Testing presentation

Testing

Intro

Types of Testing

Testing comes in many flavors depending on what you're specifically trying to test and how it accumulates in the tech stack:

  • Unit Testing
  • Integration Testing
@13protons
13protons / vue.config.js
Created April 29, 2018 18:20
How to get 'npm run build' to watch fs and rebuild webpack while using the new vue cli
// vue.config.js
module.exports = {
configureWebpack: {
watch: true
}
}
@13protons
13protons / benchmark-startswith.js
Last active December 17, 2017 19:09 — forked from dai-shi/benchmark-startswith.js
benchmark of String.startsWith equivalents in Node.js
var Benchmark = require('benchmark');
Benchmark.prototype.setup = function() {
a = ["test"];
for (var i = 0; i < 10000; i++) {
a.push("some other stuff");
}
s = a.join();
re1 = new RegExp("^test");
re2 = new RegExp("^not there");
};
@13protons
13protons / README.md
Last active August 29, 2015 14:27
Angular module that allows controllers to inspect screensize by bootstrap breakpoint names.

Angular Bootstrap Screen Size

An angular module to report on bootstrap's reponsive grid breakpoints. The injected html snipped uses bootstrap's named breakpoints so your script doesn't need to know anything about the actual css dimensions.

Install

  1. Include ScreenSize as a dependency of your app
  2. Reference ScreenSizeFactory in your controler's DI list
@13protons
13protons / sorry-array.bash
Created August 5, 2015 15:58
Node will not admit to knowing about arrays
> typeof([])
'object'
> typeof({a:[]}.a)
'object'
> []
[]
> typeof(['hi'])
'object'
> var hello = ['hi']
undefined

Can we be Agile?

Taking our team to the next level

The Basics

Ninja

Context

@13protons
13protons / tz_local.rb
Last active December 2, 2017 19:41
Localize dates in Jekyll template without specifying timezone offset
# A tiny Jekyll filter for giving custom dates a proper timezone offset
# example usage `{{ post.startDate | tz_local | date: '%l:%M %P'}}`
# Why? If you omit a timezone offset, Jekyll automatically adds +0000...which is probably not what you want.
# This let's dates like `startDate: 2015-1-14 18:00:00` render correcty in local time. DST is calculated correctly
# NOTE: This will still inherit Jekyll's timezone property as set in _config.yml
module TZLocal
def tz_local(input)
input = input + (Time.parse(input.to_s).gmt_offset) * -1
end

#codemash

This is great

lets talk about deckdown

#welcome to class
#goals for today
* learn about deckdown
* ???
* profit
##Corgis are awesome