This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function runify(obj) { | |
if(Array.isArray(obj)) { | |
return obj.map(runify); | |
} else if(typeof obj === 'object') { | |
let rune = $state(obj); | |
let output = {}; | |
for(let key in rune) { | |
if(typeof obj[key] === 'object') { | |
obj[key] = runify(obj[key]); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
import { gettable, settable, runed } from './runes.js' | |
const createFruit = (obj) => { | |
// An optional object of default values if the provided prop is nullish (try commenting each out) | |
const defaults = { | |
color: 'purple', | |
consumed: true, | |
count: 0 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cy.visit('/404') | |
//=> Test fails | |
cy.visit('/404', {failOnStatusCode: false}) | |
//=> Test passes but does not test the HTTP code was 404 | |
cy.request({url: '/404', failOnStatusCode: false}).its('status').should('equal', 404) | |
cy.visit('/404', {failOnStatusCode: false}) | |
//=> Test passes, tests that the HTTP code was 404, and tests page was visited |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
It's now a package. You can find it here: | |
https://github.com/joshnuss/svelte-local-storage-store | |
*/ | |
// Svelte store backed by window.localStorage | |
// Persists store's data locally |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Problem: cannot write to mounted folder via SSHFS , permission denied | |
Solution: use the right switches to map the remote user AND explicitly state identity file | |
sshfs -o allow_other,defer_permissions,IdentityFile=~/.ssh/id_rsa_mycompany [email protected]:/ ~/example_local_mount_point/ | |
The file system may not always do the right thing itself though--for example, if the file system retrieves file information from another computer and reports user/group IDs as is, the kernel will not see any alien IDs as belonging to the user that mounted the volume. (This can happen if user ID translation is not enabled or sometimes doesn't work with sshfs.) The | |
The defer_permissions (formerly defer_auth) option is useful in such cases. It causes osxfuse to assume that all accesses are allowed--it will forward all operations to the file system, and it is up to somebody else to eventually allow or deny the operations. In the case of sshfs, it would be the SFTP server eventually making the decision about what to allow or disal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# custom WebStorm VM options, this configuration also works well for other IDEs like phpstorm, pycharm..etc. | |
-Xms1024m | |
-Xmx2048m | |
-XX:ReservedCodeCacheSize=240m | |
-XX:+UseConcMarkSweepGC | |
-XX:SoftRefLRUPolicyMSPerMB=50 | |
-ea | |
-Dsun.io.useCanonCaches=false | |
-Djava.net.preferIPv4Stack=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM php:7.2-fpm | |
# Replace shell with bash so we can source files | |
RUN rm /bin/sh && ln -s /bin/bash /bin/sh | |
# make sure apt is up to date | |
RUN apt-get update --fix-missing | |
RUN apt-get install -y curl | |
RUN apt-get install -y build-essential libssl-dev zlib1g-dev libpng-dev libjpeg-dev libfreetype6-dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://stackoverflow.com/questions/35969656/how-can-i-generate-the-opposite-color-according-to-current-color | |
function invertColor(hex, bw) { | |
if (hex.indexOf('#') === 0) { | |
hex = hex.slice(1); | |
} | |
// convert 3-digit hex to 6-digits. | |
if (hex.length === 3) { | |
hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2]; | |
} | |
if (hex.length !== 6) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var trimCanvas = (function() { | |
function rowBlank(imageData, width, y) { | |
for (var x = 0; x < width; ++x) { | |
if (imageData.data[y * width * 4 + x * 4 + 3] !== 0) return false; | |
} | |
return true; | |
} | |
function columnBlank(imageData, width, x, top, bottom) { | |
for (var y = top; y < bottom; ++y) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"content_scripts": [ | |
{ | |
"matches": ["http://*/*", "https://*/*"], | |
"js": ["inject.js"], | |
"all_frames": true | |
} | |
], | |
"web_accessible_resources": [ | |
"content.js" |
NewerOlder