Skip to content

Instantly share code, notes, and snippets.

View cleverbeagle's full-sized avatar

Clever Beagle cleverbeagle

View GitHub Profile
(function(c,b,cs,r,d){
b.frameBorder=0;
b.style = 'position:fixed;bottom:0;left:0;width:100%;height:30vh;background:#fff;border-top:4px solid #bbb;box-shadow:0 0 2px #000;z-index:999;cursor:ns-resize;';
b.onpointerdown=function(e){b.setPointerCapture(e.pointerId);b.e=e;b.h=b.offsetHeight-4;b.style.borderTopColor='#59f'}
b.onpointermove=function(e){if(b.e)b.style.height=(b.h-e.y+b.e.y)+'px'}
b.onpointerup=function(){b.e=null;b.style.borderTopColor='#aaa'}
document.documentElement.appendChild(b);
(d=b.contentWindow.document).open();
d.write('<style>html,body{width:100%;height:100%;overflow:hidden;font:12px/1.2 system-ui,sans-serif;flex:1;display:flex;flex-direction:column;margin:0;}*{box-sizing:border-box;}button{font:inherit;}pre{margin:0;padding:4px;border-bottom:1px solid #ddd;}</style><div style="background:#ddd;border-bottom:1px solid #ccc;display:flex;padding:3px 5px 4px;align-items:center;"><div style="color:#555;flex:1;">Console</div><button onclick="console.clear()">clear</button></div>
@sleepyfox
sleepyfox / 2019-07-25-users-hate-change.md
Last active December 10, 2023 18:20
'Users hate change'

'Users hate change'

This week NN Group released a video by Jakob Nielsen in which he attempts to help designers deal with the problem of customers being resistant to their new site/product redesign. The argument goes thusly:

  1. Humans naturally resist change
  2. Your change is for the better
  3. Customers should just get used to it and stop complaining

There's slightly more to it than that, he caveats his argument with requiring you to have of course followed their best practices on product design, and allows for a period of customers being able to elect to continue to use the old site, although he says this is obviously only a temporary solution as you don't want to support both.

Why I hate TypeScript

Warning: These views are highly oppinated and might have some slightly incorrect facts. My experience with typescript was about 2 weeks in Node and a week in angular2.

Not Standard

TypeScript is implementing their own take on JavaScript. Some of the things they are writing will likely never make it in an official ES* spec either.

Technologies that have competing spec / community driven development have a history of failing; take: Flash, SilverLight, CoffeeScript, the list goes on. If you have a large code base, picking TypeScript is something your going to be living with for a long time. I can take a bet in 3 years JavaScript will still be around without a doubt.

Its also worth noting that they have built some things like module system and as soon as the spec came out they ditched it and started using that. Have fun updating!

@johanbrook
johanbrook / disable-hcr.js
Created October 6, 2015 07:58
Disable Hot Code Reload in Meteor with a settings variable (`DISABLE_AUTO_RELOAD`).
Meteor.startup(function() {
if (Meteor.settings && Meteor.settings.public && Meteor.settings.public.DISABLE_AUTO_RELOAD) {
Meteor._reload.onMigrate(function(reloadFunction) {
return [false];
});
}
});
@DavidWells
DavidWells / reset.css
Last active April 11, 2024 19:03 — forked from karbassi/reset.css
CSS reset. Follow me on the twitters for more tips: https://twitter.com/davidwells
/* http://meyerweb.com/eric/tools/css/reset/
v2.0-modified | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
@carmichaelize
carmichaelize / twitter_regex.php
Last active September 17, 2017 08:54
Twitter Links, Mentions and Hashtag Regex
<?php
//Urls
$tweet = preg_replace('/(http[^\s]+)/', '<a target="_blank" class="tweet-link" href="$1">$1</a>', $tweet->text);
//Mentions
$tweet = preg_replace('/\@([a-zA-Z1-9]+)/', '<a title="@$1" target="_blank" href="https://twitter.com/$1" class="tweet-user">@$1</a>', $string);
//Hashtags
$tweet = preg_replace('/#([a-zA-Z1-9]+)/', '<a title="#$1" target="_blank" href="https://twitter.com/search?q=%23$1&src=hash" class="tweet-hashtag">#$1</a>', $string);
@nick-desteffen
nick-desteffen / Javascript RandomDate
Created December 14, 2012 15:27
Function to generate a random date between 2 dates
start = new Date(2001, 0, 1)
end = new Date()
function randomDate(start, end) {
return new Date(start.getTime() + Math.random() * (end.getTime() - start.getTime()))
}
//http://apod.nasa.gov/apod/ap950616.html