Skip to content

Instantly share code, notes, and snippets.

@martinsam16
martinsam16 / docker-wsl2.md
Last active June 6, 2024 11:16
How to install wsl2 ubuntu + docker + docker-compose

Activate wsl2

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
wsl --set-default-version 2

Install and Configure Ubuntu

@varenc
varenc / ngrok-copy
Last active June 25, 2023 14:56 — forked from mlsteele/ngrok-copy
Copy the url of the active ngrok connection to the clipboard. Updated Oct-2019
#!/usr/bin/env bash
# Copy the url of the active ngrok connection to the clipboard. Updated for latest ngrok (Oct 2019)
#
# Usage:
# ngrok-copy # copies e.g. https://3cd67858.ngrok.io to clipboard.
# ngrok-copy -u # copies e.g. http://3cd67858.ngrok.io to clipboard.
#
# Modified from the original script at https://gist.github.com/mlsteele/f57adc1fab5c44656d6d
@rmosolgo
rmosolgo / page_example.rb
Created April 10, 2019 14:07
Generic page number / per-page pagination with GraphQL-Ruby
# This is a full-blown offset-based pagination system modelled after GraphQL-Ruby's
# built-in connections. It has a few different elements:
#
# - `::Page`, a plain ol' Ruby class for modeling _pages_ of things.
# This class handles applying pagination arguments to lists (Arrays and AR::Relations)
# and provides metadata about pagination. (Similar to `will_paginate`.)
# - `Schema::BasePage` is a generic GraphQL-Ruby object type. It's never used directly,
# but it can generate subclasses which wrap _specific_ object types in the schema.
# - `Schema::BaseObject.page_type` is a convenience method for generating page types
# from your object types. You could leave this out and make subclasses with plain ol'
@ddevault
ddevault / Makefile
Last active February 20, 2024 14:17
Tiny Wayland compositor
WAYLAND_PROTOCOLS=/usr/share/wayland-protocols
# wayland-scanner is a tool which generates C headers and rigging for Wayland
# protocols, which are specified in XML. wlroots requires you to rig these up
# to your build system yourself and provide them in the include path.
xdg-shell-protocol.h:
wayland-scanner server-header \
$(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml $@
xdg-shell-protocol.c: xdg-shell-protocol.h
@WebReflection
WebReflection / hyper-nitty-gritty.js
Last active May 30, 2023 06:09
hyperHTML, the nitty gritty
// used to retrieve template content
const templates = new WeakMap;
// used to retrieve node updates
const updates = new WeakMap;
// hyperHTML, the nitty gritty
function hyperHTML(chunks, ...interpolations) {
// if the static chunks are unknown
@idbrii
idbrii / botw-cedec2017.md
Last active May 16, 2024 14:56
An inline image version of Matt Walker's translation of CEDEC 2017 talks by Nintendo
@enzinier
enzinier / install_font_adobe_source_code_pro.sh
Created March 4, 2017 03:38
Install font Adobe Source Code Pro on Ubuntu 16.04 LTS
#!/bin/sh
# Userland mode (~$USER/), (~/).
# ~/.fonts is now deprecated and that
#FONT_HOME=~/.fonts
# ~/.local/share/fonts should be used instead
FONT_HOME=~/.local/share/fonts
echo "installing fonts at $PWD to $FONT_HOME"
mkdir -p "$FONT_HOME/adobe-fonts/source-code-pro"
@gvergnaud
gvergnaud / lazy-list.js
Last active July 31, 2023 23:57
Lazy List, implemented with es6 generators
/* ----------------------------------------- *
Lazy List Implementation
* ----------------------------------------- */
// Haskell-like infinite List, implemented with es6 generators
// Lazyness lets you do crazy stuff like
List.range(0, Infinity)
.drop(1000)
.map(n => -n)
@stiucsib86
stiucsib86 / composer-teaser.js
Created February 6, 2017 03:45
Visual Composer fixes ".vc_teaser-btn-{{ name }}" error fixes
parse: function() {
var value = this.$data_field.val(),
data = !_.isEmpty(value) ? $.parseJSON(value) : [];
if(_.isEmpty(value)) {
data = [{link: "post", name: "title"}, {name: 'image'}, {name: 'text'}];
this.$data_field.val(JSON.stringify(data));
}
_.each(data, function(block_data){
if(_.isString(block_data.name) && block_data.name.indexOf('{{') < 0) {
var $control = $('.vc_teaser-btn-' + block_data.name, this.$toolbar).prop('checked', true);
@alekseykulikov
alekseykulikov / index.md
Last active April 14, 2024 00:32
Principles we use to write CSS for modern browsers

Recently CSS has got a lot of negativity. But I would like to defend it and show, that with good naming convention CSS works pretty well.

My 3 developers team has just developed React.js application with 7668 lines of CSS (and just 2 !important). During one year of development we had 0 issues with CSS. No refactoring typos, no style leaks, no performance problems, possibly, it is the most stable part of our application.

Here are main principles we use to write CSS for modern (IE11+) browsers: