Skip to content

Instantly share code, notes, and snippets.

View Carlsson87's full-sized avatar

Daniel Carlsson Carlsson87

View GitHub Profile
@Carlsson87
Carlsson87 / ImageBlock.js
Last active August 29, 2015 14:27
Higher Order Component
var hasResources = require('./hasResources');
var EditableImageBlock = React.createClass({
// bla bla bla ...
});
module.exports = hasResources(EditableImageBlock);

Folder Structure

Motivations

  • Clear feature ownership
  • Module usage predictibility (refactoring, maintainence, you know what's shared, what's not, prevents accidental regressions, avoids huge directories of not-actually-reusable modules, etc)
@Carlsson87
Carlsson87 / Broadcast.php
Last active March 3, 2016 20:44
PHP + NodeJS + Socket.io
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => '127.0.0.1:8001',
]);
$client->request('POST', 'http://httpbin.org/post', [
'body' => 'raw data'
]);
@Carlsson87
Carlsson87 / now.js
Last active November 1, 2016 12:53
Components and such
import React from 'react';
export default React.createClass({
/*
* För att testa logiken i denna metoden behöver vi
* en instans av denna komponenten, annars är "this" inte
* bundet till något och varken "props" eller "state" är tillgängliga.
*/
doAllTheThings() {
body {
color: #212121;
font-family: "Helvetica Neue", "Calibri Light", Roboto, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
letter-spacing: 0.02em;
}
@Carlsson87
Carlsson87 / Account.elm
Last active March 29, 2022 11:21
Interface Segregation Principle
module Account expsoing (Account)
type alias Account =
{ id : Int
, name : String
, balance : Money
, instruments : List Instrument
, otherStuff : OtherStuff
}