Skip to content

Instantly share code, notes, and snippets.

View dannyrb's full-sized avatar
🕵️‍♀️
Looking for a good reason to use GH statuses

Danny Brown dannyrb

🕵️‍♀️
Looking for a good reason to use GH statuses
View GitHub Profile
#!/usr/bin/env node
/* eslint-disable no-console */
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
// edited to work with the appdir by @raphaelbadia
const path = require('path');
@jdnarvaez
jdnarvaez / GraphicOverlays.js
Last active October 10, 2023 19:21
DICOM Overlays
const overlayGroupTags = [];
for (var i = 0; i <= (0x00ee0000); i += (0x00020000)) {
overlayGroupTags.push((0x60000000 + i));
}
imageRendered(e) {
const eventData = e.detail;
if (eventData && eventData.image && eventData.image.$presentationStateDataSet) {
@johngrimes
johngrimes / nginx.conf
Created February 14, 2018 22:23
Ideal Nginx configuration for JavaScript single-page app
server {
listen 80;
root /usr/share/nginx/html;
gzip on;
gzip_types text/css application/javascript application/json image/svg+xml;
gzip_comp_level 9;
etag on;
location / {
try_files $uri $uri/ /index.html;
}
@shelldandy
shelldandy / App.js
Created October 17, 2017 19:08
nprogress with react-router in create-react-app
import React from 'react'
import { BrowserRouter as Router, Switch } from 'react-router-dom'
import routes from './routes'
import FancyRoute from './components/tools/FancyRoute'
const App = props =>
<Router>
<Switch>
{routes.map((route, i) =>
<FancyRoute key={i} {...route} />
@ediblecode
ediblecode / package-json-build-number.ps1
Created August 23, 2017 07:22
Powershell script to parse a package.json version and use as the build number in TeamCity
$version = (Get-Content package.json) -join "`n" | ConvertFrom-Json | Select -ExpandProperty "version"
$buildCounter = "%build.counter%"
$buildNumber = "$version.$buildCounter"
Write-Host "##teamcity[buildNumber '$buildNumber']"
@addyosmani
addyosmani / workbox.md
Last active January 20, 2024 16:14
Workbox recipes

Workbox runtime caching recipes

Your Service Worker script will need to import in Workbox and initialize it before calling any of the routes documented in this write-up, similar to the below:

importScripts('workbox-sw.prod.v1.3.0.js');
const workbox = new WorkboxSW();

// Placeholder array populated automatically by workboxBuild.injectManifest()
@iffy
iffy / .gitignore
Last active August 15, 2024 09:27
Example using electron-updater with `generic` provider.
node_modules
dist/
yarn.lock
wwwroot
@JacobBennett
JacobBennett / blog.md
Last active September 4, 2024 18:48
Clean up your Vue modules with ES6 Arrow Functions

Recently when refactoring a Vue 1.0 application, I utilized ES6 arrow functions to clean up the code and make things a bit more consistent before updating to Vue 2.0. Along the way I made a few mistakes and wanted to share the lessons I learned as well as offer a few conventions that I will be using in my Vue applications moving forward.

The best way to explain this is with an example so lets start there. I'm going to throw a rather large block of code at you here, but stick with me and we will move through it a piece at a time.

<script>

// require vue-resource...

new Vue({

How to setup AWS lambda function to talk to the internet and VPC

I'm going to walk you through the steps for setting up a AWS Lambda to talk to the internet and a VPC. Let's dive in.

So it might be really unintuitive at first but lambda functions have three states.

  1. No VPC, where it can talk openly to the web, but can't talk to any of your AWS services.
  2. VPC, the default setting where the lambda function can talk to your AWS services but can't talk to the web.
  3. VPC with NAT, The best of both worlds, AWS services and web.