Skip to content

Instantly share code, notes, and snippets.

💭
daydreaming

Darryl Dexter DarrylD

💭
daydreaming
Block or report user

Report or block DarrylD

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jvoorhis
jvoorhis / gist:1428465
Created Dec 3, 2011 — forked from lhitchon/gist:1424751
PHP MongoLab sample
View gist:1428465
<html>
<head>
<title>Demo</title>
</head>
<body>
<h1>PHP Mongo Test</h1>
<?php
try {
$connect = $_ENV["MONGOLAB_URI"];
$m = new Mongo($connect);
@emilong
emilong / component.jsx
Created May 27, 2016
Creating semantic links for react-router using HOCs
View component.jsx
import React, { Component } from 'react'
import { SubWidgetLink } from './routes'
export default class MyComponentWithALink extends Component {
render() {
const { widget } = this.props
return (
<div>
...
@MicheleBertoli
MicheleBertoli / decribe.js
Created Sep 17, 2016
If all you have is a hammer, everything looks like a <Nail />
View decribe.js
import React, { PropTypes } from 'react'
const Describe = ({ title, children }) => (
<div>
<h1>{title}</h1>
<ul>{children}</ul>
</div>
)
Describe.propTypes = {
@StJohn3D
StJohn3D / cheerio-react.js
Created May 19, 2016
Quickly convert react components to jQuery like Cheerio objects for testing - source code from cheerio-react on npm
View cheerio-react.js
var ReactDOMServer = require('react-dom/server');
var cheerio = require('cheerio');
module.exports = function( reactClass ) {
var staticMarkup = ReactDOMServer.renderToStaticMarkup(reactClass);
var $ = cheerio.load(staticMarkup);
return $.root().children().first();
};
View SimpleReactRouterUpgrade.js
// In v2/3 you did this:
import ReactDOM from 'react-dom'
import { Router, browserHistory, Route } from 'react-router'
ReactDOM.render(
<Router>
<Route path="/about" component={About}/>
<Route path="/:username" component={User}/>
</Router>
)
@DimitryDushkin
DimitryDushkin / example-of-react-router-query-utils.jsx
Created Feb 8, 2017
Example of using react-router query utils
View example-of-react-router-query-utils.jsx
import Modal from 'react-modal';
import { addQuery, removeQuery } from './utils-router.js';
const OPEN_MODAL_QUERY = 'openModal';
function SomeComponent({ location }) {
return <div>
<button onClick={ () => addQuery({ OPEN_MODAL_QUERY : 1 })}>Open modal</button>
<Modal
isOpen={ location.query[OPEN_MODAL_QUERY] }
@danharper
danharper / circle.yml
Created Feb 11, 2015
How we deploy InventoryBase from CircleCI
View circle.yml
machine:
php:
version: 5.6.5
dependencies:
cache_directories:
- vendor
- node_modules
pre:
- sudo pip install awscli
@islahul
islahul / react-double-colon-meaning-es6.js
Last active Jun 15, 2017
React double colon meaning JSX usage
View react-double-colon-meaning-es6.js
import './login.styl';
import Component from '../components/component.react';
import React from 'react';
import exposeRouter from '../components/exposerouter.react';
import {focusInvalidField} from '../lib/validation';
@exposeRouter
export default class Login extends Component {
static propTypes = {
@lukehoban
lukehoban / speech.js
Last active Jul 22, 2017
Project Oxford Speech APIs Node.js Sample
View speech.js
var fs = require('fs');
var util = require('util');
var request = require('request');
var clientId = 'test-app'; // Can be anything
var clientSecret = 'f6f0bfec08274b8790520a9079b808af'; // API key from Azure marketplace
var str = 'This is a cool demo to call Microsoft text to speach service in Node.js.';
console.log('Converting from text -> speech -> text.');
You can’t perform that action at this time.