Skip to content

Instantly share code, notes, and snippets.

Avatar

Dan Prince danprince

View GitHub Profile
@danprince
danprince / comment.html
Last active Mar 17, 2020
Game of Life Golf
View comment.html
<canvas id="$"></canvas><script>
// alias -1 (writing m is shorter than -1)
m=-1
// resize canvas to screen through its global variable (created from its id)
w=$.width=innerWidth,h=$.height=innerHeight
// create image data for rendering
d=new ImageData(w,h)
View helpscout-custom.css
body, input, button {
color: #0a0a29;
font-family: 'Avenir Next','Lato','Helvetica Neue',Helvetica,Arial,sans-serif;
}
.navbar .navbar-inner {
background: white;
color: #0a0a29;
font-weight: 500;
padding: 8px;
@danprince
danprince / README.md
Last active May 27, 2020
Types/Sequelize Scope Repro
View README.md

Reproducing types/sequelize/120. Run npm test to see compile errors.

index.ts(14,3): error TS2345: Argument of type '{ scopes: { human: { slack_id: { $ne: string; }; }; }; }' is not assignable to parameter of type 'InitOptions'.
  Property 'sequelize' is missing in type '{ scopes: { human: { slack_id: { $ne: string; }; }; }; }'.
index.ts(25,1): error TS2684: The 'this' context of type 'typeof Model' is not assignable to method's 'this' of type '(new () => Model) & typeof Model'.
  Type 'typeof Model' is not assignable to type 'new () => Model'.
    Cannot assign an abstract constructor type to a non-abstract constructor type.
View particles.js
function range(x) {
var xs = [];
for (var i = 0; i < x; i++) {
xs[i] = i;
}
return xs;
}
function distance(a, b) {
return (
View filter-controls.scss
@controls {
bottom {
filter {
target: connection;
default: select-all;
option {
label: "Marriages";
selector: ['connection type'='marriage'];
}
@danprince
danprince / .gitignore
Last active Dec 29, 2018
PM2 & Docker Example
View .gitignore
node_modules
*.log
View republicans.csv
We can make this file beautiful and searchable if this error is corrected: Illegal quoting in line 3.
name position state stance_1 date_1 quote_1 notes_1 link_1 stance_2 date_2 quote_2 notes_2 link_2 stance_3 date_3 quote_3 notes_3 link_3 image
Alexander, Lamar Senator TN voteForNominee 05/05/2016 politico asserts http://www.politico.com/story/2016/05/donald-trump-gop-endorsements-222894 a000360.jpg
Ayotte, Kelly Senator NH voteForNominee 04/05/2016 As she's said from the beginning, Kelly plans to support the nominee." Later Wednesday morning, however, spokeswoman Johnson added: "As a candidate herself, she hasn't and isn't planning to endorse anyone in this cycle." http://www.wmur.com/politics/wmur-first-after-trump-win-ayotte-plans-to-support-him-spokeswoman-says/39373086 antiTrump 08/10/2016 I will not vote for Donald Trump. https://twitter.com/KellyAyotte/status/784779876796665857 a000368.jpg
Barrasso, John Senator WY voteForNominee 05/05/2016 "No matter who we nominate, they're going to be better for Wyoming than Hillary Clinton or whoever the Democrats nominate." Also: "I'm going to c
View keybase.md

Keybase proof

I hereby claim:

  • I am danprince on github.
  • I am danprince (https://keybase.io/danprince) on keybase.
  • I have a public key whose fingerprint is DF59 9A8B EF34 8008 1598 FEE1 9C42 D72F 9BAF CEB4

To claim this, I am signing this object:

@danprince
danprince / concerns.md
Last active Aug 24, 2016
Redux, Aphrodite & Zaphod
View concerns.md

Concerns

React Dev Tools

Any wrapped components will be rendered into the React dev tools with their wrappers intact. This becomes pretty invasive when most of your components are using a HOC wrapper.

Here's a workaround for defining HOCs that respect stateless functional components and don't render a wrapper.

function withName(Component) {
  class EnhancedComponent extends React.Component {