Skip to content

Instantly share code, notes, and snippets.

# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Update 7 Oct 2010:
# - This example does *not* appear to work with Chrome >=6.0. Apparently,
# the WebSocket protocol implementation in the cramp gem does not work
# well with Chrome's (newer) WebSocket implementation.
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Update 7 Oct 2010:
# - This example does *not* appear to work with Chrome >=6.0. Apparently,
# the WebSocket protocol implementation in the cramp gem does not work
# well with Chrome's (newer) WebSocket implementation.
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby
@baksohyeon
baksohyeon / DOM3D.js
Created March 27, 2024 12:46 — forked from OrionReed/dom3d.js
3D DOM viewer, copy-paste this into your console to visualise the DOM topographically.
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks.
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/)
(() => {
const SHOW_SIDES = false; // color sides of DOM nodes?
const COLOR_SURFACE = true; // color tops of DOM nodes?
const COLOR_RANDOM = false; // randomise color?
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com)
const MAX_ROTATION = 180; // set to 360 to rotate all the way round
const THICKNESS = 20; // thickness of layers
const DISTANCE = 10000; // ¯\\_(ツ)_/¯
const solution = (n) => {
// input n = 0000 1111 0000(2) 인 경우
// expected output = 0001 0000 0111(2)
// 헷갈려서 적음: 왼쪽(= left = 큰 자리수) <-> 오른쪽 (= right = 작은 자리수)
/*
* [1 bit 뭉치 중 가장 오른쪽 비트의 값 구하기]
* -n 구하는 법) 1111 0000 1111(2) 보수 취함 -> 1 더함: 따라서 1111 0001 0000(2)
* 따라서 0000 1111 0000(2) & 1111 0001 0000(2)
*/
@baksohyeon
baksohyeon / test.js
Created June 25, 2022 14:56
test.js
const a = 'test';