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 / gist:bdf357186de14d44cd97
Created May 14, 2014 07:30
Demodag hilite demoing people
Array.prototype.slice.call (document.querySelectorAll('tr'),0)
.filter(function(el){
var c = el.querySelector('.class_7');
return c&&c.innerText;
})
.map(function(el){
el.setAttribute('style','background:#fff');
return el;
});
@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
@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 / 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.

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 / just-eat-veggie.user.js
Created January 16, 2011 19:42
This Chome userscript for the Danish site Just-eat.dk will dim most menues containing meat.
// ==UserScript==
// @match http://*.just-eat.dk/*
// ==/UserScript==
function oc(a){
var o={};
for(var i=0;i<a.length;i++) {o[a[i]]=true;}
return o;
};
var meats = oc('beef,blæksprutte,blæksprutter,bøf,bacon,chicken,crab,crabstick,grillkylling,kebab,kylling,kyllinge,kyllingelår,kød,kødsauce,kødstrimler,lam,lamb,lobster,okseburger,oksekød,pepperoni,pølse,pølser,rejer,rejecocktail,skinke,shawarma,tun,tuna,tunfisk'.split(','));
@cybear
cybear / css-transition-demo.html
Created January 17, 2011 12:29
Short demo of css transition of width
<html>
<head>
<style type="text/css">
#graphline {
display:block;
width:10px;
height:200px;
background-color:#000;
}
#graphline {
@cybear
cybear / css-transition-demo_snap_back.html
Created January 17, 2011 13:54
CSS transition demo with snap back
<html>
<head>
<style type="text/css">
#graphline {
display:block;
width:10px;
height:200px;
background-color:#000;
}
#graphline {
@cybear
cybear / styled-checkbox.html
Created January 18, 2011 10:07
a styled checkbox that can be used as a flipswitch
<!DOCTYPE html>
<html>
<head>
<title>Checkbox</title>
<style>
input[type=checkbox]{display:none;}
input[type=checkbox] + label{
background: #999;
height: 32px;
width: 32px;
@cybear
cybear / jslint.textmate.rb
Created January 29, 2011 10:29
A textmate command for JSLint
#!/usr/bin/env ruby
require 'cgi'
lint = `java -jar ~/Applications/jslint4java-1.4.6.jar "$TM_FILEPATH"`
lint.gsub!(/^jslint.*?((?:\/[\w\.\-]+)+).*?(\d+).*?(\d+).(.*)$/, '<p><label><a href="txmt://open?url=file://TM_FILEPATH&amp;line=\2">Line \2</a> \3</label>\4</p>')
lint.gsub!(/TM_FILEPATH/, ENV['TM_FILEPATH'])
print <<HTML
<!DOCTYPE html>
<html><head><style>
label{display:inline-block;width:85px;color:#666}
a{color:#000;text-decoration:none;font-weight:bold}