Skip to content

Instantly share code, notes, and snippets.

View johanbove's full-sized avatar
💭
Semper meliorem facio

Johan Bové johanbove

💭
Semper meliorem facio
View GitHub Profile
@Danziger
Danziger / interval.hook.ts
Last active November 15, 2023 18:00
✨ Declarative useTimeout (setTimeout), useInterval (setInterval) and useThrottledCallback (useCallback combined with setTimeout) hooks for React (in Typescript)
import React, { useEffect, useRef } from 'react';
/**
* Use setInterval with Hooks in a declarative way.
*
* @see https://stackoverflow.com/a/59274004/3723993
* @see https://overreacted.io/making-setinterval-declarative-with-react-hooks/
*/
export function useInterval(
callback: React.EffectCallback,
@siakaramalegos
siakaramalegos / webmentions.njk
Created November 22, 2019 21:06
Version of my webmentions nunjucks file used when writing my post about Webmentions and Eleventy
<div class="webmentions content-grid-sibling" id="webmentions">
{% set mentions = webmentions | getWebmentionsForUrl(metadata.url + webmentionUrl) %}
{% set reposts = mentions | webmentionsByType('repost-of') %}
{% set repostsSize = reposts | size %}
{% set likes = mentions | webmentionsByType('like-of') %}
{% set likesSize = likes | size %}
{% set replies = mentions | webmentionsByType('in-reply-to') %}
{% set repliesSize = replies | size %}
@pangratz
pangratz / application.controller.js
Last active October 5, 2016 10:55
ds-references
import Ember from 'ember';
export default Ember.Controller.extend({
actions: {
loadFamily: function() {
var personRef = this.store.getReference('person', 1);
var person = personRef.value();
var familyRef = person.belongsTo('family');
if (!familyRef.value()) {
@paulirish
paulirish / what-forces-layout.md
Last active April 30, 2024 17:56
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@DarrenN
DarrenN / get-npm-package-version
Last active April 17, 2024 16:57 — forked from yvele/get-npm-package-version.sh
Extract version from package.json (NPM) using bash / shell
# Version key/value should be on his own line
PACKAGE_VERSION=$(cat package.json \
| grep version \
| head -1 \
| awk -F: '{ print $2 }' \
| sed 's/[",]//g')
echo $PACKAGE_VERSION
@wbsch
wbsch / on-modify.blocks_attr.py
Last active February 21, 2024 19:03
Taskwarrior hook script that adds a "blocks:" pseudo-attribute for adding/modifying tasks.
#!/usr/bin/env python
#
# Adds the ability to add / modify tasks using a "blocks:" attribute,
# the opposite of "depends:".
#
# This script acts as an on-modify, on-add and on-launch hook at the same time.
#
### SETUP
# Save this file as
# ~/.task/hooks/on-modify.blocks_attr.py
@danharper
danharper / gulpfile.js
Last active April 11, 2024 08:31
New ES6 project with Babel, Browserify & Gulp
var gulp = require('gulp');
var sourcemaps = require('gulp-sourcemaps');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var browserify = require('browserify');
var watchify = require('watchify');
var babel = require('babelify');
function compile(watch) {
var bundler = watchify(browserify('./src/index.js', { debug: true }).transform(babel));
@rodneyrehm
rodneyrehm / log-requests.php
Last active August 29, 2015 14:11
IE11 Bug: Favicon Request
<?php
$logfile = '/tmp/ie-11-favicon.log';
if (empty($_GET['type'])) {
$_GET['type'] = 'html';
}
$headers = array(
'Request ' . $_GET['type'] . ' at ' . date('Y-m-d H:i:s'),

#Talks

##Jeremy Keith

  • The idea of the internet is to make everyone a publisher
  • In contrast to Apps there is no gatekeeper
  • Grunt an SASS and so on are great but raise the entry bar for content creation
  • Geocities: Founded 1994. 3rd most visited on the web. Never the prettiest, but also a playground for everyone, for normal people.
  • 1999 Yahoo acquired Geocities, in 2009 it was shut down and 15 years of content were just wiped out
  • The content might be mostly ugly, but it is also a fragment of history
@rodneyrehm
rodneyrehm / feedback.md
Last active August 29, 2015 14:01
WPDS Düsseldorf 2014 - JavaScript Group // http://wpd.mx/dusjs