This file contains hidden or 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 logo from './logo.svg'; | |
import './App.css'; | |
import { useDVCVariable } from '@devcycle/devcycle-react-sdk' | |
const variableKey = 'your variable name' | |
function App() { | |
const variable = useDVCVariable(variableKey, false) | |
return ( | |
<div className="App"> |
This file contains hidden or 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
/* | |
1. Create a new project with create-react-app | |
2. yarn add @devcycle/devcycle-react-sdk | |
3. Replace src/App.js with the following | |
4. enter your envKey and variableKey | |
*/ | |
import logo from './logo.svg'; | |
import './App.css'; | |
import { useDVCVariable, withDVCProvider } from '@devcycle/devcycle-react-sdk' |
This file contains hidden or 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 * as React from 'react'; | |
import { | |
compose, | |
StateHandler, | |
StateHandlerMap, | |
withStateHandlers, | |
} from 'recompose'; | |
export interface DialogMenuItemProps { | |
icon?: string; |
This file contains hidden or 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
// example for single field | |
const validators = { | |
validatorKey: validatorFunction, | |
}; | |
function validatorFunction(value): boolean { | |
return true; | |
} | |
const isValid = (value, validatorKeys: Array<string>): boolean => { |
This file contains hidden or 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 src="https://cdnjs.cloudflare.com/ajax/libs/ramda/0.22.1/ramda.min.js"></script> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> |
This file contains hidden or 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
## package.json changes | |
"webpack": "^2.1.0-beta.20", | |
"typescript": "^2.0.0", | |
"webpack-dev-server": "^2.1.0-beta.0", | |
"webpack-hot-middleware": "^2.12.2", | |
"webpack-split-by-path": "^0.1.0-beta.1", <-- struggles, I've removed it | |
https://github.com/BohdanTkachenko/webpack-split-by-path/pull/22#issuecomment-240050461 |
This file contains hidden or 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 tryThis(myString) { | |
return function(req, res, next) { | |
req.heyThere = myString; // should be set to "OH YEAH!" | |
next(); | |
}; | |
} | |
app.get("/", tryThis("OH YEAH!"), function(req, res) { | |
console.log(req.heyThere); | |
}); |
This file contains hidden or 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
$.urlParam = function(name, url){ | |
if(!url){ | |
url = window.location.href; | |
} | |
var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(url); | |
if (!results) | |
{ | |
return 0; | |
} | |
return results[1] || 0; |