Skip to content

Instantly share code, notes, and snippets.

View cybear's full-sized avatar

Björn Söderqvist cybear

  • Greenfield AB
  • Malmo, Sweden
View GitHub Profile
@cybear
cybear / renderlinkarray.js
Created December 16, 2020 21:01
serverside js from 2006
function renderLinkArray(linkArray) {
// rendering the array
kc.pl("<ul>");
for (var i = 0; i < linkArray.length; i++) {
cssClass = linkArray[i].completed ? "check" : "uncheck";
kc.pl('<li class="' + cssClass + '">');
kc.pl("<strong>" + linkArray[i].header + "</strong>");
kc.pl("<br/>");
if (linkArray[i].url.length > 0) {
@cybear
cybear / Why you should learn gh actions.md
Last active April 30, 2020 13:21
Frontenders: This is why you should learn Github Actions

Intro / pitch

  • My code broke the live site. Why didn't it do what I intended for it to do? How did it get all the way to production?

You're probably a frontend developer like me.

In this article I will try to convince you that you should learn to automate some actions for your repo.

Feedback cycles

@cybear
cybear / hire-me.md
Last active June 6, 2019 08:53
Hire me!

Hire me - Raise your frontend to a whole new level

I'm looking for a new gig (contractor / consultant).

Location: Malmö or Lund

Start: August

Some examples of what I can do:

@cybear
cybear / placeholder.svg.js
Created May 6, 2019 18:36
SVG image placeholder with correct dimensions and background color
const prefix = "data:image/svg+xml,";
export default props =>
prefix +
encodeURI(`
<svg
xmlns='http://www.w3.org/2000/svg'
viewBox='0 0 ${props.width} ${props.height}'>
<rect
height='100%'
@cybear
cybear / dl.sh
Created March 22, 2019 19:53
dl.sh
#!/bin/bash
while read path
do
mkdir -p "$path"
svtplay-dl -MAts -o "$path/" "https://www.svtplay.se/$path" &
sleep 15
done < $1
@cybear
cybear / dl.sh
Last active October 9, 2017 10:20
SVT Play download all episodes of all shows
#!/bin/bash
while read path
do
mkdir -p "$path"
svtplay-dl -MAts -o "$path/" "https://www.svtplay.se/$path" &
done < $1

Keybase proof

I hereby claim:

  • I am cybear on github.
  • I am tap5 (https://keybase.io/tap5) on keybase.
  • I have a public key whose fingerprint is 3D08 BBDC CF72 E40B A709 BDCE C2B7 BD65 1385 D7A3

To claim this, I am signing this object:

@cybear
cybear / error-messages.md
Created March 10, 2015 09:04
Writing tips for error messages

Writing tips for error messages

  • Describe the cause of the error, if possible.
  • Avoid blaming the user. "You typed a URL that doesn't exist" => "We can't find any page at this URL"
  • Avoid impersonal writing. "Could not upload selected files" => "We could not upload the files that you selected"
  • Suggest a next action for the user if it is plausible.
@cybear
cybear / colors.html
Created October 9, 2014 13:18
one-color.js and js arrays in chrome dev console
<html>
<head>
<title>Color development console</title>
<script src="http://cdn.jsdelivr.net/one-color/2.4.0/one-color-all.js"></script>
<script type="text/javascript">
function logColor(oneColor) {
var c = oneColor.hex();
console.log( '%c'+c, 'background:' + c);
return oneColor;
}
@cybear
cybear / ios-simulator-cache-buster.sh
Created August 14, 2014 08:31
iOS Simulator cache buster
#!/bin/sh
killall "iPhone Simulator"
folder="/Users/cybear/Library/Application\ Support/iPhone\ Simulator/7.1"
rm -rf $folder/Media/PhotoData/Caches
rm -rf $folder/Media/PhotoData/Thumbnails
rm -rf $folder/tmp
rm -rf $folder/Library/Cookies
rm -rf $folder/Library/TCC
rm -rf $folder/Library/Passes
rm -rf $folder/Library/Calendar