Skip to content

Instantly share code, notes, and snippets.

View obenjiro's full-sized avatar
🎯
Focusing

Alexey Okhrimenko obenjiro

🎯
Focusing
View GitHub Profile
@obenjiro
obenjiro / snippet.js
Created October 24, 2019 15:13 — forked from glebmachine/snippet.js
Snippet: Force Safari to switch to discrete GPU
try {
document.createElement('canvas').getContext('webgl', { powerPreference: "high-performance" })
} catch(e) {}
@obenjiro
obenjiro / gist:c69f7732b62b96099fa9bf2219a897e5
Created May 22, 2019 11:05 — forked from dmethvin/gist:1676346
Breakpoint on access to a property
function debugAccess(obj, prop, debugGet){
var origValue = obj[prop];
Object.defineProperty(obj, prop, {
get: function () {
if ( debugGet )
debugger;
return origValue;
},
<!DOCTYPE html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<a onclick="test()" href="#">run</a>
<div class="main"></div>
@obenjiro
obenjiro / jsdoit.css
Last active June 25, 2018 00:22
Canvas Conical Gradient
body {
margin: 0;
padding: 0;
background-color: #fff;
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAANUlEQVQ4jWM8c+bMfwY8wNjYmBGfPBM+SWLAqAGDwQDG///xJgOGs2fP4lUw8F4YNYAKBgAA2NYKfxDn4ZUAAAAASUVORK5CYII=);
overflow: hidden;
}
var React = require('react/addons');
var ReactIgnore = {
displayName: 'ReactIgnore',
shouldComponentUpdate (){
return false;
},
render (){
return React.Children.only(this.props.children);
}
@obenjiro
obenjiro / image-fallback.css
Last active December 31, 2015 02:38 — forked from anonymous/jsbin.IfaTodEW.css
Image fallback that is 'ok' if used without CSS
/* you can test this solution here
** http://jsbin.com/IfaTodEW/5
*/
.container {
display: table;
width: 100%;
}
.container .wraper {
display: table-cell;
@obenjiro
obenjiro / crossbrowser-column.css
Last active December 30, 2015 18:59 — forked from anonymous/jsbin.oWepeVI.css
Cross browser 2 column text that 'works' without CSS
/* you can test it here
** http://jsbin.com/oWepeVI/4
**
** you can see some results here http://www.browserstack.com/screenshots/b82dc9a833f2aa3ec76a3737ba48d942a19cc5f2
*/
.article .textpart-left {
position: absolute;
width: 50%;
margin: 0;