Skip to content

Instantly share code, notes, and snippets.

Avatar

Josh Buchea joshbuchea

View GitHub Profile
@seunggabi
seunggabi / semantic-branch-names.md
Last active Jun 2, 2020
semantic-branch-names.md
View semantic-branch-names.md

Semantic Branch Names

See how a minor change to your branch name style can make you a better programmer.

Format: <type>/#<issueNumber>-<alias>

Example

@jeanlucaslima
jeanlucaslima / Readme.md
Last active May 28, 2020
Remote Work Resources
View Readme.md

Remote Jobs general guideline

This is something I compiled during the last weeks while job hunting. If you miss something in this list, please fork or tell me on twitter and I'll add what's missing.

  1. Be careful with jobs that are not clear they hire outside US
  2. Look for job in niches (like SaaS job boards, language-specific communities, country-focused, and so on)
  3. Avoid Upwork (pay to work, no guaranteed results, often bad contracts) and Remote.com
  4. Remote.co is not Remote.com, remote.co is ok.
  5. There are companies that hire and act as a guild, but only pay as freelancer (X-team, Gun.io, and so on)
  6. Not really focused on freelancing, as it is to me more like a one-person business
@mikaello
mikaello / group-objects-by-property.md
Last active Nov 26, 2020 — forked from JamieMason/group-objects-by-property.md
Group Array of JavaScript Objects by Key or Property Value
View group-objects-by-property.md

Group Array of JavaScript Objects by Keys or Property Values

This fork of JamieMason's implementation changes the key parameter to be an array of keys instead of just a single key. This makes it possible to group by multiple properties instead of just one.

Implementation

const groupBy = keys => array =>
  array.reduce((objectsByKeyValue, obj) => {
    const value = keys.map(key => obj[key]).join('-');
@matthargett
matthargett / ts-vs-flow.md
Created Nov 19, 2018
TypeScript versus flowtype
View ts-vs-flow.md

First, let's note the difference in philosophy: TypeScript aims for fast analysis because you can to compile it down to JS before you can run/test it. flowtype is meant to be an async analysis that can run continuously with changes since the last analysis, or in parallel with your eslint and bundler rules. As such, flowtype's type system and analysis is not quite as concerned with speed or memory usage in service of potentially finding more bugs.

On two occasions I have tried to roll out flow in React Native applications, and on those two occasions we ended up backing out after a few weeks. Some detail: flow doesn't have a public roadmap, and what version you use is dictated by the react/react-native dependency and the annotations in react-native itself. flowtype also has some hard-coded aspects to help the analysis for React, so major updates to React itself sometimes also require updating flowtype to match. React Native upgrades then get gated based on your dependent libraries (or flow-typed) being updated

@JamieMason
JamieMason / group-objects-by-property.md
Created Sep 14, 2018
Group Array of JavaScript Objects by Key or Property Value
View group-objects-by-property.md

Group Array of JavaScript Objects by Key or Property Value

Implementation

const groupBy = key => array =>
  array.reduce((objectsByKeyValue, obj) => {
    const value = obj[key];
    objectsByKeyValue[value] = (objectsByKeyValue[value] || []).concat(obj);
    return objectsByKeyValue;
@hagemann
hagemann / slugify.js
Last active Nov 21, 2020
Slugify makes a string URI-friendly
View slugify.js
function slugify(string) {
const a = 'àáâäæãåāăąçćčđďèéêëēėęěğǵḧîïíīįìłḿñńǹňôöòóœøōõőṕŕřßśšşșťțûüùúūǘůűųẃẍÿýžźż·/_,:;'
const b = 'aaaaaaaaaacccddeeeeeeeegghiiiiiilmnnnnoooooooooprrsssssttuuuuuuuuuwxyyzzz------'
const p = new RegExp(a.split('').join('|'), 'g')
return string.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(p, c => b.charAt(a.indexOf(c))) // Replace special characters
.replace(/&/g, '-and-') // Replace & with 'and'
.replace(/[^\w\-]+/g, '') // Remove all non-word characters
@Frondor
Frondor / suckData.js
Last active Sep 27, 2018
HTML table data to JSON
View suckData.js
/*
* THIS IS NOT A PLUGIN
* ~ but a personal snippet
*
* Sometimes when prototyping my designs, I like to get dummy data pretty fast.
* I use this snippet to extract that data from working (aka "real life") tables from other HTML tables I find on the net.
* So I'll need that same data but inside an object.
*
* This script assumes by default the table has the following structure:
* <table>
@matteocrippa
matteocrippa / mac-setup.sh
Last active Sep 22, 2020
a script to quick setup my dev Mac
View mac-setup.sh
#!/usr/bin/env bash
echo "Install XCode first"
xcode-select --install
# Setup directories
mkdir ~/Projects
mkdir ~/Projects/Repositories
mkdir ~/Projects/Material
@narainsagar
narainsagar / nodejs - get filesize in readable format.md
Last active Mar 11, 2020
node.js - function to get file and convert the file size in humanly readable format.
View nodejs - get filesize in readable format.md

node.js - get the filesize in human readable format.

This will take filePath as a function parameter and reads the file via fs module and get the file and converts it's size into more humanly readable format.

const fs = require('fs');
function getFileSize(filename) {
  const stats = fs.statSync(filename);
  //console.log('stats', stats);
  const {size} = stats;
@zcorpan
zcorpan / htmlquiz-iframe-escape.md
Last active Sep 20, 2016
#HTMLQuiz what happens (iframe escape)
View htmlquiz-iframe-escape.md

#HTMLQuiz what happens?

<iframe id=x></iframe>
<script>
x.contentDocument.body.appendChild(x);
</script>
  • wild DOMException appears
  • iframe escapes
You can’t perform that action at this time.