View gist:10446664
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.container { | |
background: #f00; | |
width:50px; | |
height: 50px; | |
} | |
.container:before { | |
content: " "; | |
display: block; | |
background:#fff; |
View gist:11137765
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
video { | |
min-width: 100%; | |
min-height: 100%; | |
position: fixed; | |
left: 0; | |
top: 0; | |
z-index: -1; | |
} |
View gist:11137971
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.my-fixed-item { | |
-webkit-backface-visibility: hidden; | |
-webkit-transform: translateZ(0); | |
} |
View gist:11138248
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
html,body { | |
/* this fix background images with fixed positioning */ | |
overflow-x:hidden | |
} |
View gist:11138298
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.addEventListener('scroll', function (e) { | |
// unfortunately this will never fire | |
console.log('we are scrolling!'); | |
}, false); | |
document.querySelector('body').addEventListener('scroll', function (e) { | |
// this one will fire though | |
console.log('yay!'); | |
}, false); |
View gist:11138662
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var body = document.querySelector('body'); | |
body.scrollTop = 100; | |
console.log(body.scrollTop); // 0 :( |
View gist:11139066
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// quick and dirty check for webkit, which has a bug that it does not compute the | |
// proper scrollTop, when overflowX is set on the body. We can use this to decide | |
// when we have to disable fixed-attachment backgrounds, because they lead to a rendering | |
// issue in webkit. This test is just a naive implementation and probably could be improved | |
// but works fine for now. | |
var overflowScrollTopBuggy = function overflowScrollTopBuggy () { | |
if (testFixedBackgrounds.buggy) { | |
return testFixedBackgrounds.buggy; | |
} | |
var body = document.querySelector('body'); |
View gist:a3a7803e4643ca3f2884
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this works fine | |
render: function() { | |
var content = []; | |
if (this.state.showResults && this.props.results.length) { | |
content.push(<ResultList results={this.props.results} onResultSelectAction={this.onResultSelectAction} />); | |
} | |
return ( | |
<div className="searchbox-wrapper"> |
View gist:f163d62924dd9d29dff9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Backbone = require('backbone'); | |
var _ = require('lodash'); | |
// extend `Backbone.AssociatedModel` with a create method, which will be | |
// used to create new models for us, instead of using `new` | |
// shamelessly inspired by Supermodel | |
var Cached = Backbone.AssociatedModel.extend({ | |
_cached: false, | |
_ref: 0, | |
ref: function () { |
View json_manipulator.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION public.json_append(data json, insert_data json) | |
RETURNS json | |
LANGUAGE sql | |
AS $$ | |
SELECT ('{'||string_agg(to_json(key)||':'||value, ',')||'}')::json | |
FROM ( | |
SELECT * FROM json_each(data) | |
UNION ALL | |
SELECT * FROM json_each(insert_data) | |
) t; |
OlderNewer