Skip to content

Instantly share code, notes, and snippets.

View DSchau's full-sized avatar

Dustin Schau DSchau

View GitHub Profile
#!/bin/sh
mkdir /media/WD\ Passport
modprobe fuse
udevil --mount /dev/sda1
@DSchau
DSchau / authentication-interceptor.js
Created July 27, 2016 15:19
authentication interceptor
export function AuthenticationInterceptor($log) {
'ngInject';
return {
request(config) {
$log.debug('intercepted');
return config;
}
};
}
@DSchau
DSchau / interceptors-module.js
Last active July 27, 2016 15:23
The module for the interceptors
import { AuthenticationInterceptor } from './authentication-interceptor';
import { interceptorConfig } from './config';
export default angular.module('sampleApp.services.interceptors', [
])
.config(interceptorConfig)
.factory('AuthenticationInterceptor', AuthenticationInterceptor);
@DSchau
DSchau / services-module.js
Created July 27, 2016 15:22
services modules
import InterceptorsModule from './interceptors/'; // the interceptors module must be named index.js
export default angular.module('sampleApp.services', [
InterceptorsModule.name
]);
@DSchau
DSchau / config.js
Created July 27, 2016 15:23
interceptor angular config
export function interceptorConfig($httpProvider) {
'ngInject';
$httpProvider.interceptors.push('AuthenticationInterceptor');
}
@DSchau
DSchau / get-users.js
Last active July 19, 2017 14:08
Get all users from google play developer console
(function getAllUsers() {
const table = Array.from(document.querySelectorAll('table'))
.filter(el => el.className.length > 0)
.pop();
if (!table) {
throw new Error('Unable to find a valid table. Perhaps Google Play Developer tweaked their markup?');
}
const users = Array.from(table.querySelectorAll('tr'))
import React from 'react';
import Link from 'gatsby-link';
import Helmet from 'react-helmet';
// import '../css/index.css'; // add some style if you want!
export default function Index({
data
}) {
const { edges: posts } = data.allMarkdownRemark;
@DSchau
DSchau / polyfills.ts
Created August 4, 2017 18:36
Angular's (insane) polyfills file
/**
* This file includes polyfills needed by Angular and is loaded before the app.
* You can add your own extra polyfills to this file.
*
* This file is divided into 2 sections:
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
* file.
*
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
@DSchau
DSchau / index.js
Created September 9, 2017 20:27
The GraphQL query showing how to format a date!
export const pageQuery = graphql`
query IndexQuery {
site {
siteMetadata {
title
author
}
}
allMarkdownRemark(sort: { order: DESC, fields: [frontmatter___date] }) {
edges {
const crypto = require('crypto');
const get = require('lodash.get');
const setNullToEmpty = data =>
Object.keys(data).reduce((merged, key) => {
if (key !== 'null') {
merged[key] = data[key] === null ? '' : data[key];
}
return merged;
}, {});