Skip to content

Instantly share code, notes, and snippets.

View webdesignberlin's full-sized avatar
:octocat:
...

Michael Raguse webdesignberlin

:octocat:
...
View GitHub Profile
@Heydon
Heydon / light.js
Last active June 21, 2018 10:16
Function to determine if a hex color is light (crude)
function isLight(hex) {
let vals = hex.substring(1).split('').map((h, i) => {
if (!/^\d+$/.test(h)) {
h = parseInt(h, 16)
}
return parseInt(i % 2 < 1 ? h * 16 : h)
})
return vals.reduce((n, x) => n + x) > (765 / 2)
}
@aronwoost
aronwoost / README.md
Last active July 16, 2018 08:15
How to install node.js and CouchDB on a Google Compute Engine instance

#How to install node.js and CouchDB on a Google Compute Engine instance

Start and ssh into instance

Make sure you have a Google Compute engine account, have a project created and the gcutil command line tool installed.

Since want to ssh without the gcutil tool, you need to a your ssh key to the instance in addition to the already existing google_compute_engine key (used for gcutil).

@WebReflection
WebReflection / lys.js.md
Last active March 21, 2019 22:05
A `lys.js` crazy non sense

lys is a programming language that produces WASM, and its design goal is to be as simple as possible, yet useful to create utilities.

I've been thinking about a subset of JavaScript that could run natively on the browser, similarly to asm.js, but with the ability, through a dedicated parser, to target another language able, on its own, to produce WASM.

The following crazy non sense works already thanks to an agglomerated of modern and deprecated JS features and it might be interesting as experiment to see if a JS to WASM compiler, through the lys indirection, could be possible.

function lys(fn) {

  /*! (c) Andrea Giammarchi */
@rpontes
rpontes / jquery.nodoubletapzoom.js
Created November 23, 2012 19:27 — forked from johan/jquery.nodoubletapzoom.js
A jQuery plugin to selectively disable the iOS double-tap-to-zoom action on specific page elements (and have that generate two click events instead).
// jQuery no-double-tap-zoom plugin
// Triple-licensed: Public Domain, MIT and WTFPL license - share and enjoy!
(function($) {
var IS_IOS = /iphone|ipad/i.test(navigator.userAgent);
$.fn.nodoubletapzoom = function() {
if (IS_IOS)
$(this).bind('touchstart', function preventZoom(e) {
var t2 = e.timeStamp
@mnpenner
mnpenner / screenshot.js
Last active December 5, 2019 16:08
Save a screenshot with selenium-webdriver for JavaScript
var webdriver = require('selenium-webdriver');
var fs = require('fs');
var driver = new webdriver.Builder().build();
webdriver.WebDriver.prototype.saveScreenshot = function(filename) {
return driver.takeScreenshot().then(function(data) {
fs.writeFile(filename, data.replace(/^data:image\/png;base64,/,''), 'base64', function(err) {
if(err) throw err;
});
@lluchs
lluchs / nginx-uberspace.md
Last active January 3, 2020 18:14
nginx auf dem Uberspace

nginx auf dem Uberspace

Installation

Lade die neueste "mainline"-Version (hier 1.7.9) von http://nginx.org/en/download.html herunter und entpacke sie:

$ wget http://nginx.org/download/nginx-1.7.9.tar.gz 
$ tar xf nginx-1.7.9.tar.gz
@forabi
forabi / Webpack 2.0.7-beta vs Rollup
Last active January 28, 2020 08:54
Webpack 2 vs Rollup
❯ rollup --version
rollup version 0.25.3
❯ time rollup -c ./rollup.js
rollup -c ./rollup.js 4.65s user 0.22s system 118% cpu 4.131 total
❯ time webpack
Hash: ebb00bbccd954c114d3c
Version: webpack 2.0.7-beta
Time: 3623ms
@webdesignberlin
webdesignberlin / vue.md
Created January 29, 2020 12:00 — forked from DawidMyslak/vue.md
Vue.js and Vuex - best practices for managing your state

Vue.js and Vuex - best practices for managing your state

Modyfing state object

Example

If you have to extend an existing object with additional property, always prefer Vue.set() over Object.assign() (or spread operator).

Example below explains implications for different implementations.

@dmcclintock
dmcclintock / Symantic-No-Skew-Single-Slant-CSS3-"Razorblade-Rectangles".markdown
Last active March 4, 2020 06:22
Single Slant CSS3 Divs - ("Responsive Razorblade Rectangles")

Single Slant CSS3 Divs - ("Responsive Razorblade Rectangles")

=============================================================== Fully responsive and cross-browser compatible rectangles with slanted edges using pseudo-elements (as supposed to the "skew" transform). In contrast with the skew alternative, the method employed does not cause the rectangles' skewed sides to affect containing elements (such as text), and has minimal impact on surrounding elements in terms of positioning. The code affords full use of other CSS3 styling techniques for additional customization, such as CSS styling, hover states, transitions, etc.

Free for all developers to use and pass along - share the <3

See it in action at TacoBarCompany.com.

To-Do:

@paulofierro
paulofierro / wkwebview_disable_magnification.m
Last active March 13, 2020 16:11
Disable magnification in WKWebView
// Remember to @import WebKit at the top of the class
// Javascript that disables pinch-to-zoom by inserting the HTML viewport meta tag into <head>
NSString *source = @"var meta = document.createElement('meta'); \
meta.name = 'viewport'; \
meta.content = 'width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no'; \
var head = document.getElementsByTagName('head')[0];\
head.appendChild(meta);";
WKUserScript *script = [[WKUserScript alloc] initWithSource:source injectionTime:WKUserScriptInjectionTimeAtDocumentEnd forMainFrameOnly:YES];