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
mport React from 'react' | |
const withPusher = WrappedComponent => { | |
class WithPusher extends React { | |
subscribeToChannel() { | |
const channelName = getChannelName(); | |
subscribeToChannel(channelName); | |
} |
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
<script type="text/javascript"><!--{literal}> | |
function getVisitor() { | |
console.log('getVisitorCalled'); | |
var visitorInput = document.getElementById('ID_form79fea66b_guest_register_receipt_visitor'); | |
var visitor = visitorInput && visitorInput.value; | |
return visitor; | |
} | |
function redirectToVisitorPage() { | |
console.log('redirect called.'); |
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
// Imperative way | |
const getNames = users => { | |
const activeUsers = users.filter(user => user.isActive); | |
return activeUsers.map(user => user.userName) | |
} | |
// Using pure functions. | |
import {map, filter, compose} from 'ramda' | |
const isUserActive = user => user.isActive; | |
const getUserName = user => user.userName; | |
const getNames = compose(map(getUserName), filter(isUserActive) |
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 add => (x, y) => x + y; |
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 Bar { | |
printHello() { | |
console.log('Hello') | |
} | |
} |
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 Foo { | |
printHello = () => { | |
console.log('Hello') | |
} | |
} |
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, {Component} from 'react'; | |
import Table from './Table'; | |
import Card from './Card'; | |
class Controller extends Component { | |
state = { | |
view: 'list' | |
} | |
switchToCardView = () => { |
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
$category = array('0' => 'Cultural', '1' => 'Technical', '2' => 'Sports'); | |
echo $this->Form->input('category', array('type' => 'select', 'options' => $category)); |
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
<VirtualHost *:80> | |
# The ServerName directive sets the request scheme, hostname and port that | |
# the server uses to identify itself. This is used when creating | |
# redirection URLs. In the context of virtual hosts, the ServerName | |
# specifies what hostname must appear in the request's Host: header to | |
# match this virtual host. For the default virtual host (this file) this | |
# value is not decisive as it is used as a last resort host regardless. | |
# However, you must set it for any further virtual host explicitly. | |
#ServerName www.example.com |