Skip to content

Instantly share code, notes, and snippets.

View camsong's full-sized avatar
🤖
GPTing

Cam Song camsong

🤖
GPTing
View GitHub Profile
@camsong
camsong / l2tp.sh
Created September 14, 2012 11:20
install vpn l2tp on ubuntu
#!/bin/bash
if [ $(id -u) != "0" ]; then
printf "Error: You must be root to run this tool!\n"
exit 1
fi
clear
printf "
####################################################
# #
@camsong
camsong / Snowfall.markdown
Created December 21, 2015 07:08
Snowfall

Snowfall

Just trying to create a snowfall effect using SVG and CSS animations. JavaScript is used to simply randomize the location of the snowflakes. Full warning: works in Chrome, Safari, Firefox and later versions of Opera. Internet Explorer (up to and including 11) doesn't seem to like it.

A Pen by Chip Cullen on CodePen.

License.

@camsong
camsong / what-forces-layout.md
Created October 25, 2017 16:00 — forked from paulirish/what-forces-layout.md
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.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
@camsong
camsong / cloudSettings
Created October 22, 2017 14:07
Visual Studio Code Settings Sync Gist
{"lastUpload":"2017-10-22T14:07:53.099Z","extensionVersion":"v2.8.3"}
function createStore(reducer, initialState) {
let currentState = initialState;
let listeners = [];
function subscribe(listener) {
listeners.push(listener);
const isSubscribed = true;
return function unsubscribe() {
if (!isSubscribed) return
isSubscribed = false
@camsong
camsong / frp.md
Created January 12, 2016 06:11 — forked from ohanhi/frp.md
Learning FP the hard way: Experiences on the Elm language

Learning FP the hard way: Experiences on the Elm language

by Ossi Hanhinen, @ohanhi

with the support of Futurice 💚.

Licensed under CC BY 4.0.

Foreword

@camsong
camsong / gist:c129c670fc8911065df5
Created December 28, 2015 08:22 — forked from chenglou/gist:40b75d820123a9ed53d8
Thoughts on Animation

Interesting part (unmounting & API) is at the end if you're not interested in the rest =).

Stress Tests

This animation proposal is just an attempt. In case it doesn't work out, I've gathered a few examples that can test the power of a future animation system.

  1. Parent is an infinitely spinning ball, and has a child ball that is also spinning. Clicking on the parent causes child to reverse spinning direction. This tests the ability of the animation system to compose animation, not in the sense of applying multiple interpolations to one or more variables passed onto the child (this should be trivial), but in the sense that the parent's constantly updating at the same time as the child, and has to ensure that it passes the animation commands correctly to it. This also tests that we can still intercept these animations (the clicking) and immediately change their configuration instead of queueing them.

  2. Typing letters and let them fly in concurrently. This tests concurrency, coordination of an array of ch

# ============================================================
# PluginName v0.0.0
# http://URL
# ============================================================
# Copyright 2012 The Beans Group
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#