Skip to content

Instantly share code, notes, and snippets.

💭
Ship Ship Ship

Brock Boren brockthebear

💭
Ship Ship Ship
Block or report user

Report or block brockthebear

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
@brockthebear
brockthebear / .hyper.js
Last active Oct 30, 2019
Hyper Settings
View .hyper.js
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// Choose either "stable" for receiving highly polished,
// or "canary" for less polished but more frequent updates
updateChannel: 'canary',
@brockthebear
brockthebear / web-dev-resources.md
Created Jul 29, 2019
Resources for anybody wanting to learn how to code (with an emphasis on front-end tech).
View web-dev-resources.md

Web Dev Resources

⭐ = favorite


Required Reading

Paul Ford: What Is Code? - It’s long but nothing ever got me so excited about learning to code as much as this.

Tutorials

  • Free (mostly)
@brockthebear
brockthebear / fabfile.py
Last active Jun 7, 2019
Example deployment of a Node app using Fabric
View fabfile.py
#!/usr/local/bin/python3
# List tasks with fab2 -l
import os
import os.path as path
from fabric2 import Config, Connection, task
import patchwork.transfers as transfer
# Define values in .env file.
@brockthebear
brockthebear / mongo-export-csv.js
Last active May 16, 2019
Export a MongoDB collection and write to a CSV. Uses json2csv, async/await, and dotenv.
View mongo-export-csv.js
require('dotenv').config();
const { AsyncParser } = require('json2csv');
const fs = require('fs');
const MongoClient = require('mongodb').MongoClient;
const url = `mongodb://localhost:27017`;
const HEADERS = ['first_name', 'last_name', 'middle_name', 'id'];
const FIELDS = ['name.first_name', 'name.last_name', 'name.middle_name', 'id'];
@brockthebear
brockthebear / convert.sh
Last active Mar 12, 2019
Recursively find and convert files in place using ImageMagick and Mogrify
View convert.sh
# This command would be run from the parent folder that:
# 1. contains the file(s) to be converted
# 2. has subdirectories that contain files to be converted
# 3. both of the above.
# This example finds all .tif files and converts them to .pdf,
# but any conversion supported by ImageMagick could be used here.
# If you don't have ImageMagick installed, you can do so here (https://imagemagick.org/script/download.php)
# for linux
View Leap.cs
using System;
public static class Leap
{
public static bool IsLeapYear(int year)
{
bool multipleOf4 = YearIsDivisibleByFactor(year, 4);
bool multipleOf100 = YearIsDivisibleByFactor(year, 100);
bool multipleOf400 = YearIsDivisibleByFactor(year, 400);
View HelloWorld.cs
using System;
public class HelloWorld
{
private const string Greetings = "Hello, World!";
public string Hello()
{
return Greetings;
}
@brockthebear
brockthebear / csv_concat.py
Created May 18, 2017
Combine multiple CSVs into one.
View csv_concat.py
import glob
files = glob.glob("*.csv")
header_saved = False
with open('output.csv', 'w') as fout:
for file in files:
with open(file) as fin:
header = next(fin)
if not header_saved:
You can’t perform that action at this time.