Skip to content

Instantly share code, notes, and snippets.

View fdjones's full-sized avatar

Freddie fdjones

View GitHub Profile
@fdjones
fdjones / what.js
Last active November 15, 2018 17:01
const g = (() => {
const fn = f;
const p0 = 1;
return (a0, a1) => fn(a0, p0, a1);
})();
import gql from 'graphql-tag';
import { withApollo, Query, Mutation } from 'react-apollo';
<Fragment>
<Query>{... stuff here}</Query>
<Mutation mutation={gql`${deleteFile}`} variables={{ name, path }} > // [eslint] Unexpected use of 'name'. [no-restricted-globals]
{postMutation => <button onClick={postMutation}>Submit</button>}
</Mutation>
</Fragment>
const format = fileList => fileList.map(({ time }) => ({
savedAt: moment(time).format(),
}));
const getNameWithInitial = function () {
let initial = this._gender === 'male' ?
'Mr. ' :
'Mrs. ';
return initial + this._name;
}
export class Person {
constructor(name, gender) {
// function must return
function foo() {
if (someCondition) {
return this.props.history.push('/somewhere');
}
}
// this was ok
function foo() {
if (someCondition) {
doStuff();
return;
}
ALTER TABLE <tablename>
ADD columnname datatype;
<script id='script-batch' type='text/javascript'>
(function(d){
var js = d.createElement('script'); js.async = true; js.defer = true;
js.src = 'https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js';
d.getElementsByTagName('head')[0].appendChild(js);
})(document);
</script>
var foo = { a: 2 };
var b = foo;
//typing b into the console returns { a: 2 }
foo = { a: 10 };
//typing b into the console still returns { a: 2 }
var foo = { a: 2 };
var b = foo;
//typing b into the console returns { a: 2 }
foo.bar = 'hi';
let pickList;
setTimeout(async () => {
const foo = await apiCallWrapper(store, getParcelPickListItems, parcel.id);
pickList = foo[0];
}, 5000);