Skip to content

Instantly share code, notes, and snippets.

View vtellier's full-sized avatar

Vincent Tellier vtellier

View GitHub Profile
@vtellier
vtellier / .vimrc
Last active March 24, 2022 10:27
My vimrc
filetype plugin indent on
set number " Show line numbers
set tabstop=4 " show existing tab with 4 spaces width
set expandtab " On pressing tab, insert 4 spaces
set ignorecase " Case insentivie searches
set autoindent " Always set autoindentation
set copyindent " Use the previous indentation when autoindenting
set shiftwidth=4 " when indenting with '>', use 4 spaces width
set shiftround " Use multiple shift width when using '>'
@vtellier
vtellier / repeat-collapse-snippet.html
Last active March 28, 2018 10:39
Polymer iron-collapse with dom-repeat snippet
<link rel="import" href="../../bower_components/iron-icons/iron-icons.html">
<link rel="import" href="../../bower_components/iron-icon/iron-icon.html">
<link rel="import" href="../../bower_components/iron-collapse/iron-collapse.html">
<dom-module id="your-element">
<template>
<style>
.heading {
padding: 10px 15px;
@vtellier
vtellier / corsDummyLambda.js
Created December 13, 2017 22:17
A simple (and not perfect) AWS lambda function to work around the ignored `Access-Control-Allow-Origin: *` wildcard in Google Chrome.
exports.handler = (event, context, callback) => {
// Checking properties case insensitively, might be a better solution but this one works
// => https://stackoverflow.com/a/5833423/519376
Object.prototype.hasOwnPropertyCI = function(prop) {
return Object.keys(this)
.filter(function (v) {
return v.toLowerCase() === prop.toLowerCase();
}).length > 0;
};
Object.prototype.getPropertyCI = function(prop) {
@vtellier
vtellier / mi-utils.js
Created June 12, 2017 19:42
A Polymer 2.0 mixin that enables to factorize basic utilitary functions
OhUtils = function(superClass) {
return class extends superClass {
constructor() {
super();
}
static get properties() {
return {
@vtellier
vtellier / Timer.h
Created November 30, 2016 12:56
Deterministic, re-settable, stoppable C++11 timer
#pragma once
#include <exception>
#include <system_error>
#include <thread>
#include <condition_variable>
#include <mutex>
#include <functional>
#include <chrono>
#include <memory>
@vtellier
vtellier / LastError.h
Last active June 23, 2016 09:39
GetLastError() description retrieval function dependency free (except string).
#pragma once
#include <string>
// Be careful, use this only for debugging.
// The function is inline and contains a lot of strings so might increase drastically the weight of your binary.
/*
// Usage exemple:
string desc;