Skip to content

Instantly share code, notes, and snippets.

View molarmanful's full-sized avatar
🐉
X

Ben Pang molarmanful

🐉
X
View GitHub Profile
@molarmanful
molarmanful / 0.md
Last active April 25, 2024 08:53
Javascript-golfed Rubik's Cube scramblers.

Javascript-Golfed Rubik's Cube Scramblers

All scramblers here are split into 4 categories (puzzles of all types are welcome):

  1. Random moves
  2. Random moves, basic cancellation (no R' R, U U2, etc.)
  3. Random moves, extensive cancellation (no R L R, U D2 U2, etc.)
  4. Random state

Random moves scramblers for WCA puzzles must generate scrambles of lengths:

  • 2x2: 11
@molarmanful
molarmanful / index.html
Last active January 17, 2017 20:52
A really small Rubik's Cube timer. Demo: http://codepen.io/molarmanful/pen/eNgLNL
<h1 id="a">0.000</h1><p id="s"></p>
@molarmanful
molarmanful / shuffle-84-bytes.js
Last active August 29, 2015 14:24
Javascript-golfed Fisher-Yates Shuffle algorithms, dependent only on the Math.random function (basically, it's cross-browser). Each function takes an array as input and outputs scrambled array.
function(a){for(b=a.length;b;a[b]=[a[c],a[c]=a[b]][0])c=0|Math.random()*b--;return a}
@molarmanful
molarmanful / LICENSE.txt
Last active August 29, 2015 14:24 — forked from 140bytes/LICENSE.txt
General-purpose stopwatch - 140byt.es
DO WHAT YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2015 Benjamin Pang <molarmanful.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT YOU WANT TO PUBLIC LICENSE
@molarmanful
molarmanful / LICENSE.txt
Last active August 29, 2015 14:24 — forked from 140bytes/LICENSE.txt
HTML editor with live preview - 140byt.es
DO WHAT YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2015 Benjamin Pang <molarmanful.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT YOU WANT TO PUBLIC LICENSE
@molarmanful
molarmanful / rgb2hex.js
Last active July 4, 2016 16:08
RGB2HEX - a golfed ES6 function that converts RGB values in the form of 'r g b'.
h=>'#'+h.split` `.map(x=>(x<16?0:'')+(x*1).toString(16)).join``
@molarmanful
molarmanful / blingquine.js
Created October 9, 2015 02:31
The Bling Quine: An ES6 quine that I made.
$=_=>`$=${$};$()`;$()
@molarmanful
molarmanful / es7-code-progression.md
Last active September 26, 2018 08:02
Recovered from my now-defunct blog.

ES7 Code Golf Progression

This time, I have a program that takes numerical expressions with the parentheses, exponentiation, multiplication, division, addition, and subtraction and outputs each successive step used to solve the expression using order of operations. Example inputs:

1+1
(51*5)/8
63/(91*(5+779))

Spaces are the only types of whitespace allowed.

Before I start, I almost always think about the algorithm I will use to solve the problem:

@molarmanful
molarmanful / README.md
Created April 6, 2017 00:11
How to set up my adaptable scheme.

Put this in your .zshrc:

colo(){
  cat "/home/x/.colors/$1" && (
    echo $1 > ~/.curcol
    xrdb ~/.Xresources
    xrdb -merge "/home/x/.colors/$1"
    killall polybar
    polybar top -r &!

feh --bg-fill "/home/x/Pictures/themes/$1.png" || feh --bg-fill "/home/x/Pictures/themes/default.png"

! If you decide to use the music module, get https://github.com/mooow/mooowscripts/blob/master/uscripts/playerctl-cmus and put the script in your $PATH.
[colors]
background = ${xrdb:background}
foreground = ${xrdb:foreground}
black = ${xrdb:color0}
red = ${xrdb:color1}
green = ${xrdb:color2}
yellow = ${xrdb:color3}
blue = ${xrdb:color4}
magenta = ${xrdb:color5}