Skip to content

Instantly share code, notes, and snippets.

View Bamblehorse's full-sized avatar
🙃
Coding | Writing | Meditating 🙂

Jon Wood Bamblehorse

🙃
Coding | Writing | Meditating 🙂
View GitHub Profile
@Bamblehorse
Bamblehorse / cloudSettings
Last active October 12, 2022 10:56
Visual Studio Code Settings Sync Gist
{"lastUpload":"2022-01-27T16:21:13.616Z","extensionVersion":"v3.4.3"}

Keybase proof

I hereby claim:

  • I am bamblehorse on github.
  • I am bamblehorse (https://keybase.io/bamblehorse) on keybase.
  • I have a public key ASA2DlmEpQpwxN9c_DQEoVHNMoC0HIPyAACi_QWoMPHANgo

To claim this, I am signing this object:

@Bamblehorse
Bamblehorse / readme.md
Created July 24, 2018 15:11
readme for my tiny package

@bamblehorse/tiny

npm (scoped) npm bundle size (minified)

Removes all spaces from a string.

Install

@Bamblehorse
Bamblehorse / package.json
Created July 24, 2018 14:59
tiny version 1
{
"name": "@bamblehorse/tiny",
"version": "1.0.0",
"description": "Removes all spaces from a string",
"license": "MIT",
"repository": "bamblehorse/tiny",
"main": "index.js",
"keywords": [
"tiny",
"npm",
@Bamblehorse
Bamblehorse / index.js
Created July 24, 2018 14:29
The export for my tiny npm module
module.exports = function tiny(string) {
if (typeof string !== "string") throw new TypeError("Tiny wants a string!");
return string.replace(/\s/g, "");
};
@Bamblehorse
Bamblehorse / index.js
Last active July 19, 2018 12:51
Testing the useful npm package just-a-space
const space = require("just-a-space");
console.log(typeof space, space.length, space === " "); // string 1 true
const chokidar = require("chokidar");
const watcher = chokidar
.watch("src/components/**", { ignored: /node_modules/ })
.on("addDir", (path, event) => {
const name = path.replace(/.*\/components\//, "");
const goodToGo = /^[^\/_]*$/.test(name);
if (goodToGo) createFiles(path, name);
});
function createFiles(path, name) {
const files = {
index: "index.jsx",
test: `${name}.test.js`,
sass: `${name}.sass`
};
if (name !== "components") {
const writeFile = writeToPath(path);
const toFileMissingBool = file => !fileExists(path)(file);
const fs = require('fs');
const fileExists = path => file => fs.existsSync(`${path}/${file}`);
const fileExistsInSrc = fileExists('/src'); // file => fs.existsSync(`${path}/${file}`)
fileExistsInSrc('index.js') // true || false
const fs = require('fs');
const fileExists = path => file => fs.existsSync(`${path}/${file}`);
const writeToPath = path => (file, content) => {
const filePath = `${path}/${file}`;
fs.writeFile(filePath, content, err => {
if (err) throw err;
console.log("Created file: ", filePath);