Skip to content

Instantly share code, notes, and snippets.

Jeff Handley jeffhandley

Block or report user

Report or block jeffhandley

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
View droppedstyle.cshtml
my-custom-class:before {
top: 0px;
/* this renders fine */
my-custom-class::before {
top: 0px;
/* this css class is not rendered */
jeffhandley / dont-need-do.jsx
Created Dec 7, 2017
You don't need `do` to have if statements in functions
View dont-need-do.jsx
function View({ loading, error, ...otherProps }) {
if (loading) {
return (<Loading />);
if (error) {
return (<Error error={error} />);
return (<MyLoadedComponent {...otherProps} />);
jeffhandley / PropDefinitions.jsx
Created Nov 6, 2017
Defining PropTypes for nested components
View PropDefinitions.jsx
/* NameDisplay.js */
import ReactPropTypes from 'prop-types';
const NameDisplay = ({name}) => (
First Name: {name.first}
Last Name: {name.last}
jeffhandley / magic.js
Created Aug 6, 2017
Process your OneDrive Camera Roll into year/month folders
View magic.js
function loadCameraRoll(url, max, done) {
url = url || "";
max = max || 200;
console.log('LOADING PHOTOS');
url: url,
dataType: "json",
headers: { "Authorization": "Bearer " + window.token },
jeffhandley / open-slack-profile-pictures.js
Created Apr 25, 2017
Open profile pictures for all members of a slack channel
View open-slack-profile-pictures.js
document.querySelectorAll("#channel_page_all_members a.lazy.member_preview_link.member_image.thumb_20")
.forEach(function(member) {^url\(\'(.*)-48\'\)$/, "$1-128"));
jeffhandley / package.json
Last active Sep 19, 2016
webpack configs
View package.json
"scripts": {
"build:core": "babel src -d lib && webpack",
"build": "NODE_ENV=production npm run build:core",
"postbuild": "echo 'Build Complete'",
"predev": "webpack --config",
"dev": "NODE_ENV=development babel-node src/server",
"start": "nodemon --watch src/ -e js,jsx --exec npm run dev"
"devDependencies": {
jeffhandley / Greeting.jsx
Last active Jul 20, 2016
Is there a better way to build this React component other than using ReactDOMServer.renderToStaticMarkup and dangerouslySetInnerHTML?
View Greeting.jsx
// Returns a translated form of "Welcome back, <strong>Jeff</strong>. It's good to see you again."
// There are several messages that can be supplied and they can have different sentence structures
// Regardless of the message, the name needs to be wrapped in a <strong> tag
import React from 'react';
import ReactDOMServer from 'react-dom/server';
export default React.createClass({
displayName: 'Greeting',
jeffhandley / page.js
Last active Feb 13, 2016
A pattern for server-side async data loading with React components
View page.js
import React from 'react';
export default (req, res, callback) => {
// Do async work, consuming data off req if needed
// Potentially set headers or other data on res
// When all the data is loaded, call the callback with the component
render() {
return (
jeffhandley / gist:7883875
Created Dec 10, 2013
Named objects in a graph
View gist:7883875
// What Example 46 shows here:
"@graph" : [
"@id": "#homer",
"": "Homer"
"@id": "#bart",
"": "Bart",
"": { "@id": "#homer" }
jeffhandley / Get-RandomPassword.ps1
Created Aug 22, 2013
Get a new random password
View Get-RandomPassword.ps1
Returns a random, timestamped, password
# Base64-encode the Guid to add some additional characters
[DateTime]::Now.ToString("MMMddyy") + "!" + [Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes([Guid]::NewGuid().ToString()))
You can’t perform that action at this time.