Skip to content

Instantly share code, notes, and snippets.

@MagicControl
MagicControl / build.gradle
Last active January 31, 2017 14:54
asset-pipeline dependencies
buildscript {
dependencies {
classpath "com.bertramlabs.plugins:asset-pipeline-gradle:2.13.1"
}
}
dependencies {
runtime "com.bertramlabs.plugins:asset-pipeline-grails:2.13.1"
assets "com.bertramlabs.plugins:jsx-asset-pipeline:2.13.1"
}
@MagicControl
MagicControl / build.gradle
Last active January 31, 2017 14:53
jsx-asset-pipeline config
assets {
minifyJs = true
minifyCss = true
enableSourceMaps = true
minifyOptions = [
languageMode : 'ES6',
targetLanguage: 'ES5'
]
}
@MagicControl
MagicControl / asset-pipeline.js
Last active January 31, 2017 14:53
including react
//= require react/react.min.js
//= require react/react-dom.min.js
@MagicControl
MagicControl / test-component.jsx
Last active January 31, 2017 14:52
simple react component
class TestComponent extends React.Component {
constructor() {
super();
this.state = {date: new Date()};
}
componentDidMount() {
this.timerID = setInterval(
() => this.tick(),
1000
<!DOCTYPE html>
<html>
<head>
<asset:javascript src="asset-pipeline.js"/>
</head>
<body>
<div>
<span>Current time is:</span>
</div>
<div id="app"></div>
<!DOCTYPE html>
<html>
<head>
<asset:javascript src="asset-pipeline.js"/>
</head>
<body>
<div>
<span>Current time is:</span>
</div>
var A = function() {
this.a = 10;
}
A.prototype.hello = function() {
console.log('Hello from A!');
}
var B = function() {
}
var b = new B()
b instanceof A //true
b instanceof B //true
b.a = 25;
console.log(b.a) // 25
delete b.a // true
console.log(b.a) // 10
var A = function() {
this.a = [];
}
A.prototype.hello = function() {
console.log('Hello from A!');
}
var B = function(a) {
if (a) {
this.a = a;