Skip to content

Instantly share code, notes, and snippets.

View jguffey's full-sized avatar

Josh Guffey jguffey

View GitHub Profile
@jguffey
jguffey / App.js
Last active August 12, 2021 17:34
React Router nested Route match example.
import React, { Fragment } from 'react';
import {
BrowserRouter as Router,
Switch,
Route,
useRouteMatch,
useLocation,
} from 'react-router-dom';
const ScopedApp = () => {
@jguffey
jguffey / Avatar.jsx
Created June 12, 2021 20:16
Example Level 3 of DPR pattern
/** @jsx jsx */
import { jsx } from '@emotion/react';
import { useContext } from 'react';
import PropTypes from 'prop-types';
// In reality we'd store the context in it's own file
import UserContext from './DetailsPageLayout.jsx';
import DefaultAvatar from './img/default.png';
export const Avatar = (props) => {
@jguffey
jguffey / DetailsPageLayout.jsx
Last active June 12, 2021 20:13
Example Level 2 of DPR pattern
/** @jsx jsx */
import { jsx } from '@emotion/react';
import { Component, createContext } from 'react';
export const UserContext = createContext({
user: null,
});
class DetailsPageLayout extends Component {
static propTypes = {
@jguffey
jguffey / ExampleDetailsPage.jsx
Created June 12, 2021 20:03
Example Level 1 of DPR pattern
/** @jsx jsx */
import { jsx } from '@emotion/react';
import { connect } from 'react-redux';
import { Component } from 'react';
import PropTypes from 'prop-types';
import { loadUserBySlug } from '../../services/state/actionCreators';
import { Loading } from '../../components/core';
import { DetailsPageLayout } from './DetailsPageLayout';

Keybase proof

I hereby claim:

  • I am jguffey on github.
  • I am jguffey (https://keybase.io/jguffey) on keybase.
  • I have a public key whose fingerprint is 06DE 2D72 EABA 8246 6431 5983 DFA5 87AE D84C E18D

To claim this, I am signing this object:

@jguffey
jguffey / gist:4d86e37ae6ba506b3f67
Last active August 29, 2015 14:05
test copy for a project
{
"Aries": {
"yesterday": "Aires Yesterday - You're probably feeling especially energetic but with little if any outlet for your energy, Aries. Increased irritability and frustration could tempt you to take it out on friends, children, or your significant other. On days like this you might want to consider jogging, yoga, or aerobics. These can produce endorphins that override the stress. Go for it.",
"today": "Aires - Today - Jealousy could rear its ugly head today, Aries. This could involve a romantic relationship. Jealousy is often groundless, so avoid it by doing some communicating. This is the time to make the effort to turn a disadvantage into an advantage. Strong emotions can work for you under some circumstances. A passionate reconciliation is better than an angry estrangement.",
"tomorrow": "Aires - Tomorrow - Expect some great news regarding money, possibly professional advancement. You may have to control the urge to break into tears of joy, Aries. A female friend could b
### Keybase proof
I hereby claim:
* I am jguffey on github.
* I am jguffey (https://keybase.io/jguffey) on keybase.
* I have a public key whose fingerprint is EBFD 1BD6 3771 28C7 6826 C653 8E25 9CF4 3D96 27C2
To claim this, I am signing this object:
function animate(){
for(var i = 0; i < 97; i ++){
(function(i){
if(i < 10){
setTimeout(function(){
$("#animation").attr('src', "path/to/stills/folder/prefix-frame0"+i+".jpg");
}, i * 60);
}else{
setTimeout(function(){
if(i == 96){
private function listCompanyNames(){
$this->load->model('Company_model');
$companies = array(0 => 'none');
$raw_companies = $this->Company_model->get_all();
if(!$raw_companies || count($raw_companies) < 1){
return $companies;
}
foreach($raw_companies as $_company ){
$companies[$_company->id] = $_company->name;
}
# urls.py
url(r'^s/$', 'searchservice'), # Add this in somewhere.
# views.py
from django.http import HttpResponse
from django.core import serializers
from indextank.client import ApiClient