In this demo, backtracking algorithm is used for generating the sudoku. Difficulty and solvability is totally random as I randomly left a number of hints from a full-filled board.
A Pen by Mustafa Enes on CodePen.
| // ⚠ IMPORTANT: this is old and doesn't work for many different edge cases but I'll keep it as-is for any of you want it | |
| // ⚠ IMPORTANT: you can find more robust versions in the comments or use a library implementation such as lodash's `merge` | |
| // Merge a `source` object to a `target` recursively | |
| const merge = (target, source) => { | |
| // Iterate through `source` properties and if an `Object` set property to merge of `target` and `source` properties | |
| for (const key of Object.keys(source)) { | |
| if (source[key] instanceof Object) Object.assign(source[key], merge(target[key], source[key])) | |
| } |
| (function(doc) { | |
| const TWO_PI = Math.PI * 2; | |
| const HALF_PI = Math.PI / 2; | |
| const RADIUS_SCALE = 0.05; | |
| const RADIUS_SD = 15; | |
| const POLYGON_SIDES = 5; | |
| const POSITION_SD = 0.04; | |
| const BASE_DEFORMATIONS = 3; | |
| const LAYER_DEFORMATIONS = 3; | |
| const LAYERS = 40; |
| function lightOrDark(color) { | |
| // Check the format of the color, HEX or RGB? | |
| if (color.match(/^rgb/)) { | |
| // If HEX --> store the red, green, blue values in separate variables | |
| color = color.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/); | |
| r = color[1]; | |
| g = color[2]; |
| #!/bin/sh | |
| # | |
| # Based on a work of Miquel van Smoorenburg <[email protected]> | |
| # | |
| ### BEGIN INIT INFO | |
| # Provides: supervisor | |
| # Required-Start: $remote_fs $network $named | |
| # Required-Stop: $remote_fs $network $named | |
| # Default-Start: 2 3 4 5 | |
| # Default-Stop: 0 1 6 |
In this demo, backtracking algorithm is used for generating the sudoku. Difficulty and solvability is totally random as I randomly left a number of hints from a full-filled board.
A Pen by Mustafa Enes on CodePen.
| /** | |
| * Sets up a DOM MutationObserver that watches for elements using undefined CSS | |
| * class names. Performance should be pretty good, but it's probably best to | |
| * avoid using this in production. | |
| * | |
| * Usage: | |
| * | |
| * import cssCheck from './checkForUndefinedCSSClasses.js' | |
| * | |
| * // Call before DOM renders (e.g. in <HEAD> or prior to React.render()) |
| // Calulates power with integer exponent | |
| @function pow($number, $exponent) { | |
| $value: 1; | |
| @if $exponent > 0 { | |
| @for $i from 1 through $exponent { | |
| $value: $value * $number; | |
| } | |
| } @else if $exponent < 0 { | |
| @for $i from 1 through -$exponent { |
| #!/bin/bash | |
| MAX=10 | |
| if [[ ! -z "$1" ]]; then | |
| MAX=$1 | |
| fi | |
| for i in $( seq $MAX ); do | |
| FILE=image${i}.jpg | |
| curl 'https://thispersondoesnotexist.com/image' -H 'authority: thispersondoesnotexist.com' -H 'pragma: no-cache' -H 'cache-control: no-cache' -H 'upgrade-insecure-requests: 1' -H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.80 Safari/537.36' -H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3' -H 'referer: https://thispersondoesnotexist.com/' -H 'accept-encoding: gzip, deflate, br' -H 'accept-language: en-US,en;q=0.9' --compressed -o $FILE |
| REM Delete eval folder with licence key and options.xml which contains a reference to it | |
| for %%I in ("WebStorm", "IntelliJ", "CLion", "Rider", "GoLand", "PhpStorm", "Resharper", "PyCharm") do ( | |
| for /d %%a in ("%USERPROFILE%\.%%I*") do ( | |
| rd /s /q "%%a/config/eval" | |
| del /q "%%a\config\options\other.xml" | |
| ) | |
| ) | |
| REM Delete registry key and jetbrains folder (not sure if needet but however) | |
| rmdir /s /q "%APPDATA%\JetBrains" |
| CC = gcc | |
| RM = rm -f | |
| CFLAGS = -Wall | |
| LIBS = -lbcm2835 | |
| TARGET = pi_fan_hwpwm | |
| all: $(TARGET) |