Skip to content

Instantly share code, notes, and snippets.

@faustinoaq
faustinoaq / myAngular.html
Last active November 16, 2024 04:17
Front-end libraries (React, Vue, Angular) and the basic principles of how they work, all in a single file using pure JavaScript (VanillaJS).
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My Angular from Scratch</title>
<style>
.my-component {
font-family: Arial, sans-serif;
@martinsam16
martinsam16 / docker-wsl2.md
Last active November 8, 2024 13:03
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 November 5, 2024 13:10 — 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 November 6, 2024 04:57
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 September 13, 2024 23:03
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);