Skip to content

Instantly share code, notes, and snippets.

View brittanmcg's full-sized avatar
🙂
We'll get there

Brittan McGinnis brittanmcg

🙂
We'll get there
View GitHub Profile
@brittanmcg
brittanmcg / lightbox.jsx
Created February 7, 2017 20:48
Lightbox implementation
import React from 'react';
import Lightbox from 'react-images';
import Button from '../Button';
const MyComponent = ReactCreateClass({
getInitialState() {
return {
lightboxIsOpen: false
};
@brittanmcg
brittanmcg / threeTimeZones.json
Created January 30, 2017 23:38
3 different timezone accounts
{
"company" : {
"name" : "Los Angeles",
"description" : "Company1`",
"address" : {
"street1" : "123 main st",
"city" : "San Diego",
"state" : "CA",
"zip" : "92101"
}
@brittanmcg
brittanmcg / nav.js
Last active January 4, 2017 16:42
route switch statement
const fullLink = '/advertisers/accounts';
const route = '/advertisers/accounts/create';
const accountId = '1234a';
console.log(route === `${fullLink}/create`) // => true
let isActive;
switch (route) {
case route === fullLink:
isActive = true;
break;
case route === `${fullLink}/create`:
@brittanmcg
brittanmcg / gist:0098f329bf2bc7a11bcc
Created February 1, 2016 01:29
need to switch computers
////////////////////////////////////////////////////////////////////////////////
// Excercise:
//
// http://facebook.github.io/react/docs/reusable-components.html#prop-validation
//
// - Don't access `USERS` directly in the app, use a prop
// - Validate Gravatar's `size` property, allow it to be a
// a number, or a string that can be converted to a number,
// ie: `size="asdf"` should warn (hint: parseInt)
// - in emailType, what if the prop name isn't email? what if we wanted
{
"OfferID":876,
"OfferValues":[
{
"key":"first-name",
"value":"Some"
},
{
"key":"last-name",
"value":"Guy"
@brittanmcg
brittanmcg / contactform.js
Created October 17, 2015 13:06 — forked from insin/contactform.js
React contact form example
/** @jsx React.DOM */
var STATES = [
'AL', 'AK', 'AS', 'AZ', 'AR', 'CA', 'CO', 'CT', 'DE', 'DC', 'FL', 'GA', 'HI',
'ID', 'IL', 'IN', 'IA', 'KS', 'KY', 'LA', 'ME', 'MD', 'MA', 'MI', 'MN', 'MS',
'MO', 'MT', 'NE', 'NV', 'NH', 'NJ', 'NM', 'NY', 'NC', 'ND', 'OH', 'OK', 'OR',
'PA', 'RI', 'SC', 'SD', 'TN', 'TX', 'UT', 'VT', 'VA', 'WA', 'WV', 'WI', 'WY'
]
var Example = React.createClass({
@brittanmcg
brittanmcg / object.js
Created October 7, 2015 22:13
object with some values as objects
var obj = {
name: "Simon",
age: "20",
clothing: {
style: "simple",
isDouche: false
}
}
@brittanmcg
brittanmcg / gist:e6978c196396cc8d511b
Created January 23, 2015 22:48
vagrant provision output
==> default: Running provisioner: puppet...
==> default: Running Puppet with site.pp...
==> default: Notice: /Stage[main]//Node[default]/Exec[composer-install-dependencies]/returns: Loading composer repositories with package information
==> default: Notice: /Stage[main]//Node[default]/Exec[composer-install-dependencies]/returns: Installing dependencies (including require-dev) from lock file
==> default: Notice: /Stage[main]//Node[default]/Exec[composer-install-dependencies]/returns: - Installing zeeto/flux (dev-master f319731)
==> default: Notice: /Stage[main]//Node[default]/Exec[composer-install-dependencies]/returns: Cloning f319731a3c54bc3e31dad07c74dec02c8d7350be
==> default:
==> default: Notice: /Stage[main]//Node[default]/Exec[composer-install-dependencies]/returns:
==> default: Notice: /Stage[main]//Node[default]/Exec[composer-install-dependencies]/returns:
==> default: Notice: /Stage[main]//Node[default]/Exec[composer-install-dependencies]/returns:
@brittanmcg
brittanmcg / gist:1b5ce7ba3f99fb7378ed
Created January 13, 2015 18:19
Twig conditional
{% if random(1) == 1 %}
{% set sidebarQuery = "withSidebar" %}
{% include 'file.html.twig' %}
{% else %}
{% set sidebarQuery = "withoutSidebar" %}
{% endif %}
@brittanmcg
brittanmcg / gist:94ba50488efb9e418778
Last active August 29, 2015 14:12
Assigning a variable from ajax response
myObj = {
myAttr: function(){
$.ajax({
type: "GET",
url: myApi,
dataType: "jsonp",
success: function (data) {
return data
}
})