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
// @ts-check | |
const path = require("path"); | |
/** | |
* NOTE: | |
* | |
* See the following section of Storybook's docs for more information | |
* on how the exported function in this file integrates with Storybook's | |
* existing webpack config: | |
* |
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
const path = require("path"); | |
const loaderUtils = require("loader-utils"); | |
const { fluid, fixed } = require("gatsby-plugin-sharp/index"); | |
function getFileObject(absolutePath, hash, name, extension) { | |
return { | |
id: `${absolutePath}${hash}`, | |
name: name, | |
absolutePath, |
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
import React from "react"; | |
import styled from "styled-components"; | |
import { storiesOf } from "@storybook/react"; | |
import { text, withKnobs } from "@storybook/addon-knobs"; | |
import { mobileViewport, addFullWidthWrapperDecorator } from "../utils"; | |
import { Instagram } from "../../src/components/shared/Instagram"; | |
/** Important pieces here. Images located in ../static/ */ | |
import Instagram1 from "gatsby-image-fluid!../static/instagram_1.jpg"; |
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
const path = require("path"); | |
const loaderUtils = require("loader-utils"); | |
const { fluid, fixed } = require("gatsby-plugin-sharp/index"); | |
function getFileObject(absolutePath, hash, name, extension) { | |
return { | |
id: `${absolutePath}${hash}`, | |
name: name, | |
absolutePath, |
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
const path = require("path"); | |
const CopyPlugin = require("copy-webpack-plugin"); | |
module.exports = ({ config }) => { | |
config.plugins.push( | |
new CopyPlugin([ | |
{ from: "stories/static", to: "public/images" }, // Copy static files | |
{ from: "public/static", to: "./static/" } // Copy gatsby generated static files. | |
]) |
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
<?php | |
class Only{ | |
protected $_container = null; | |
public function __construct($value){ | |
$this->_container = $value; | |
} | |
public function get(){ |
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
<?php | |
require '/home/thomas/projects/functional-php/vendor/autoload.php'; | |
//Manually currying | |
$test = function($start){ | |
return function($length) use ($start){ | |
return function($string) use ($start, $length){ | |
return substr($string, $start, $length); | |
}; |
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
<?php | |
function compose($a, $b){ | |
return function() use ($a, $b){ | |
$args = func_get_args(); | |
return $b(call_user_func_array($a, $args)); | |
}; | |
} | |
class Just{ |
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
<?php | |
interface Functor{ | |
public function __invoke($function); | |
} | |
abstract class AFunctor implements Functor{ | |
protected $_storage = null; | |
public function __construct($data = null){ | |
$this->set($data); |
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
<?php | |
$arr = ['one', 'two', 'three', 'four']; | |
//First class functions | |
//Functions in variables | |
$filter = function($item){ | |
return strlen($item) > 3; | |
}; | |
var_dump(array_filter($arr, $filter)); |
NewerOlder