Skip to content

Instantly share code, notes, and snippets.

View mattatcha's full-sized avatar

Matt Aitchison mattatcha

View GitHub Profile
@brigand
brigand / updateIfChanged.md
Last active April 27, 2016 14:30
updateIfChanged

updateIfChanged is a pattern that allows preventing updates based on a unique key. It inverts control of updates from a dumb child to the smarter parent. It's particularly useful because it can avoid the normal issue of children and callbacks causing a rerender when it's not truly required.

The alternative workaround is usually memoizing the children and callbacks which can be expensive, complicated, and leak memory.

Implementation

import deepEqual from 'lodash/isEqual';
@NickCraver
NickCraver / Windows10-Setup.ps1
Last active February 6, 2025 04:09
(In Progress) PowerShell Script I use to customize my machines in the same way for privacy, search, UI, etc.
##################
# Privacy Settings
##################
# Privacy: Let apps use my advertising ID: Disable
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo -Name Enabled -Type DWord -Value 0
# To Restore:
#Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo -Name Enabled -Type DWord -Value 1
# Privacy: SmartScreen Filter for Store Apps: Disable
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppHost -Name EnableWebContentEvaluation -Type DWord -Value 0
@iamralch
iamralch / ssh_client.go
Last active August 21, 2024 05:26
SSH client in GO
package main
import (
"fmt"
"io"
"io/ioutil"
"net"
"os"
"strings"
render-template() {
declare filename="$1"; shift
local script k v
for var in "$@"; do
IFS='=' read k v <<< "$var"
script="s/\$\$$k/${var##${k}=}/;$script"
done
cat "$filename" | sed "$script"
}
@jsjolund
jsjolund / xmonad.hs
Last active October 17, 2023 22:57
Example of using xmonad inside xfce
-------------------------------------------------------------------------------
-- Configuration for using Xmonad inside Xfce, KDE and standalone.
--
-- Xfce: It is recommended to disable/remove xfwm4 and xfdesktop.
-- KDE: Plasma works with xmonad, except
-- 1. Mouse cursor cannot focus on empty monitors.
-- 2. Panel start-menu search field cannot receive input.
-------------------------------------------------------------------------------

2015-01-29 Unofficial Relay FAQ

Compilation of questions and answers about Relay from React.js Conf.

Disclaimer: I work on Relay at Facebook. Relay is a complex system on which we're iterating aggressively. I'll do my best here to provide accurate, useful answers, but the details are subject to change. I may also be wrong. Feedback and additional questions are welcome.

What is Relay?

Relay is a new framework from Facebook that provides data-fetching functionality for React applications. It was announced at React.js Conf (January 2015).

@andrewwebber
andrewwebber / coreos-router.yaml
Last active May 3, 2018 06:06
CoreOS - Router
#cloud-config
coreos:
units:
- name: sshd.socket
command: restart
content: |
[Socket]
ListenStream=2222
Accept=yes
@brigand
brigand / _readme.md
Last active January 9, 2021 16:09
ImmutableJS macros for SweetJs

These macros are designed to provide a literal notation for [immutable-js][1] using [sweetjs][2].

The most interesting being the Map literal

var map = im{"foo": "bar", "baz": "quux"};

This compiles to the 2d array version of Immutable.Map.

@nmerouze
nmerouze / main.go
Last active January 17, 2025 21:20
JSON-API with Go and MongoDB: Final Part
package main
import (
"encoding/json"
"log"
"net/http"
"reflect"
"time"
"github.com/gorilla/context"
@jetsonhacks
jetsonhacks / sideBySide.sh
Last active March 27, 2023 12:11
Gstreamer two MJPG Webcams
#!/bin/sh
# Run two video webcam feeds in two different windows
# Script assumes that:
# Microsoft LifeCam Studio is video0
# Logitech c920 is video1
# Both cameras run max 1920x1080 MJPG, but two have both on a USB bus they can run @ 1280x720 max
# MS is made a little smaller
# text overlay and clockoverlay may be added to the pipeline, but render poorly
VELEM="v4l2src device=/dev/video0 do-timestamp=true"
VCAPS="image/jpeg, width=640, height=480, framerate=30/1"