Skip to content

Instantly share code, notes, and snippets.

// calculator.js
(function (root, factory) {
if (typeof exports === 'object') {
// CommonJS
module.exports = factory();
} else if (typeof define === 'function' && define.amd) {
// AMD
define([], function () {
return (root.returnExportsGlobal = factory());
});
'use strict';
import React from 'react-native';
import { Provider } from 'react-redux/native';
import Routes from '../Routes'
import store from '../Store'
class App extends React.Component {
render() {
class Garden
def initialize(gardener)
@gardener = gardener
end
end
class Gardener
def initialize(workday, boots)
@workday = workday
@boots = boots
class Garden
def initialize(gardener)
gardener.set_workday(Workday.new)
gardener.set_boots(BootsWithMassiveStaticInitBlock.new)
@gardener = gardener
end
end
class Gardener
def set_workday(workday)
@lesniakania
lesniakania / new_in_constructor-good.rb
Last active June 29, 2016 13:53
“new” Keyword in the Constructor or at Field Declaration
class House
attr_reader :bedroom
def initialize(bedroom)
@bedroom = bedroom
end
def enough_space?(people_count)
bedroom.beds_count >= people_count
end
@lesniakania
lesniakania / new_in_constructor-bad.rb
Last active June 29, 2016 13:51
“new” Keyword in the Constructor or at Field Declaration
class House
attr_reader :bedroom
def initialize
@bedroom = Bedroom.new
end
def enough_space?(people_count)
bedroom.beds_count >= people_count
end
class Submission
MINIMAL_AGE = 18
attr_accessor :age
def can_attend?
age > MINIMAL_AGE
end
end
'use strict';
import React from 'react-native';
let {
StyleSheet,
} = React;
let colors = {
blue: '#1EC1F7',
'use strict'
import Axios from 'axios';
const BASE_URL = 'http://localhost:3000/api';
class ApiConnector {
get(path, data = {}) {
return Axios.get(`${BASE_URL}${path}`, { params: data });
}
import ActionTypes from '../constants/ActionTypes';
import Connection from '../lib/Connection';
const _requestSubmissionsList = (submissionType) => {
return {
type: ActionTypes.REQUEST_SUBMISSIONS_LIST,
submission_type: submissionType
};
}