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
class Accordion extends React.Component { | |
constructor(props) { | |
super(props) | |
this.state = { | |
activeItem: null, | |
} | |
} | |
toggle = (event, index) => this.setState(state => ({ activeItem: state.activeItem === index ? null : index })) | |
render() { | |
return ( |
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
/** | |
* Directive to instantly enable/disable multiple checkboxes based on a master checkbox. | |
* Changing slave checkboxes will update the master checkbox accordingly, including the indeterminate state. | |
* | |
* Usage example: | |
* | |
* <label><input type="checkbox" select-all="theProperties"> Select all</label> | |
* <div ng-repeat="property in properties"> | |
* <label><input type="checkbox" rel="theProperties" ng-model="property.checked"> {{ property.label }}</label> | |
* </div> |
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
{ | |
"products": [ | |
{ | |
"id": 448082, | |
"title": "GoPro HERO4 Silver", | |
"price": 36900, | |
"description": "De GoPro HERO4 Silver is een waardige opvolger van GoPro 3-serie.", | |
"thumbnail": "https://image.coolblue.io/products/448082?width=200&height=200" | |
}, | |
{ |
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
function App(props) { | |
return <Header title="Fancy" />; | |
} | |
function Header(props) { | |
return <Title {...props} />; | |
} | |
function Title(props) { | |
return <div>{props.title}</div>; |
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
/* async-action.js */ | |
import SomeService from './some-service'; | |
export function doAsync(arg) { | |
return dispatch => { | |
// SomeService.doSomething returns a promise which resolves to the passed argument | |
SomeService.doSomething(arg).then(result => { | |
const action = { type: 'ASYNC_SUCCESS', payload: result }; | |
dispatch(action); | |
}).catch(error => { |
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
/** | |
* parseNumeric('123') === 123 | |
* parseNumeric('10 abc') === undefined | |
* parseNumeric('10.10%') === 10.1 | |
* parseNumeric(' 10.1000 ') === 10.1 | |
* parseNumeric('10. 01%' ) === undefined | |
* parseNumeric('10.0 %') === 10 | |
*/ | |
function parseNumeric(number) { | |
var num = ('' + number).trim(); |
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
$stateProvider.state('projects.edit.section', { | |
url: '/:sectionCode', | |
templateUrl: function(stateParams) { | |
return 'partials/project/' + stateParams.sectionCode + '.html'; | |
} | |
}); |
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
/* | |
* Usage: | |
* - open https://updates.xebia.com/smoelenboek/ | |
* - paste this file into chrome developer tools js console | |
* - look at the picture in the top-left corner and choose from the names in the js console | |
*/ | |
images = jQuery('dt.portrait img') | |
answer = [ , , , ] |
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
function embed(data, sizes) { | |
const formattedData = {}; | |
for (let uuid in sizes) { | |
if (sizes.hasOwnProperty(uuid) && data[uuid]) { | |
formattedData[uuid] = { | |
name: uuid, | |
w: sizes[uuid].width, | |
h: sizes[uuid].height, | |
vars: { | |
id: data[uuid], |
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 | |
if (!defined('SED_CODE')){die('Wrong URL.'); } | |
$currenttpl = file_get_contents($mskin); | |
if (mb_strpos($currenttpl, "{PAGE_TEXT_ID_") !== false) | |
{ | |
$matches = array(); | |
preg_match_all("#{(?P<tag>PAGE_TEXT_ID_(?P<id>[0-9]+))}#", $currenttpl, $matches, PREG_SET_ORDER); | |
foreach ($matches as $match){ | |
$p_tag = $match['tag']; |