Skip to content

Instantly share code, notes, and snippets.

View rivertam's full-sized avatar
🎑
who can keep track

Ben Berman rivertam

🎑
who can keep track
View GitHub Profile
@rivertam
rivertam / t-no-style.html
Last active July 11, 2016 18:22
Taboola's got no style
<!DOCTYPE html>
<html>
<head>
<script async src="http://cdn.taboola.com/libtrc/aplus/loader.js">
</script>
<script>
var inDapIF=true;
</script>
<style type="text/css">
@rivertam
rivertam / ia_insights.js
Created June 20, 2016 16:59
IA insights
const retrieved = {
"instant_articles_insights": {
"data": [
{
"time": "2016-03-16T08:00:00+0000",
"value": "1"
},
{
"time": "2016-03-17T08:00:00+0000",
"value": "63"
@rivertam
rivertam / OpenArticleRender.js
Created May 16, 2016 16:37
Rendering the OpenedArticle
class OpenArticle extends Component {
static propTypes = {
article: PropTypes.article.isRequired,
getCard: PropTypes.func.isRequired,
openArticle: PropTypes.oneOfType([PropTypes.bool, PropTypes.article]).isRequired,
};
shouldComponentUpdate(newProps) {
const oldOpenSlug = this.props.openArticle && this.props.openArticle.slug;
const newOpenSlug = newProps.openArticle && newProps.openArticle.slug;
@rivertam
rivertam / render.js
Created May 16, 2016 16:17
Problematic rendering
render() {
const style = this.getStyles().position ?
this.getStyles() :
absolutePositionStyles(this.props.getCard(), this.getStyles());
const classes = ['bubble'];
if (!this.state.static) {
classes.push('is-animating');
}
@rivertam
rivertam / hi.js
Created February 29, 2016 23:25
Test non-async async
const hi = async () => 5;
hi().then(num => console.log(num)); // results in 5... eventually
@rivertam
rivertam / rescue.rb
Created January 24, 2016 19:13
Maybe a rescue?
thr = Thread.new do
started = false
finished = false
def cleanup
puts '...started cleaning resource' unless started
started = true
sleep 1
puts '...finished cleaning resource' unless finished
finished = true
@rivertam
rivertam / gist:8789afd4f97167823325
Created December 23, 2015 04:26
Errors with boilerplate
ERROR in ./src/containers/index.js
Module build failed: SyntaxError: /home/ben/calico/src/containers/index.js: Unexpected token (1:7)
> 1 | export App from './App/App';
| ^
2 | export Chat from './Chat/Chat';
3 | export Home from './Home/Home';
4 | export Widgets from './Widgets/Widgets';
at Parser.pp.raise (/home/ben/calico/node_modules/babylon/lib/parser/location.js:24:13)
at Parser.pp.unexpected (/home/ben/calico/node_modules/babylon/lib/parser/util.js:82:8)
at Parser.pp.expect (/home/ben/calico/node_modules/babylon/lib/parser/util.js:76:33)