Skip to content

Instantly share code, notes, and snippets.

View sethbergman's full-sized avatar
🐋
Building Docker Images for Dell Technologies

Seth Bergman sethbergman

🐋
Building Docker Images for Dell Technologies
View GitHub Profile
@sethbergman
sethbergman / README.md
Created February 9, 2017 02:42 — forked from cjolly/README.md
How to securely set rails secret key when you deploy to Heroku.

Stop Versioning Rails Secret Tokens

After reading Code Climate's Rails' Insecure Defaults I realized I was guilty of breaking rule 3. Versioned Secret Tokens. Here's how I fixed it.

Use dotenv in development and test environments:

# Gemfile
gem 'dotenv-rails', groups: [:development, :test]
@sethbergman
sethbergman / postgresql-debugger-install-ubuntu
Created February 15, 2017 09:58 — forked from jhngrant/postgresql-debugger-install-ubuntu
Installing the PL/pgSQL Debugger Extension (pldbgapi) for pgAdmin III on PostgreSQL 9.4 and Ubuntu 14.10
# PostgreSQL can be on a remote server but you'll need root privileges in Linux and superuser in PostgreSQL.
# First install build tools
sudo su
aptitude install build-essential
aptitude install postgresql-server-dev-9.4
# Clone and build the PL/pgSQL server-side debugger
class TodosService {
constructor(private @Inject(API_CONFIG) api, private http: Http) {}
getTodos() {
return http.get(this.api.todos);
}
}
export function getTodos() {
return {
type: API_REQUEST,
payload: {
url: "http://api.com/todos",
method: "GET",
onError: GET_TODOS_ERROR,
onSuccess: GET_TODOS_SUCCESS
}
}
@sethbergman
sethbergman / reporter_to_airtable.rb
Created March 16, 2017 09:55 — forked from craigeley/reporter_to_airtable.rb
An example of moving Reporter entries to Airtable in near-real time using Reporter's JSON output and the Airtable API.
#!/usr/bin/env ruby
# Scipt Example for Moving Reporter Entries to Airtable Rows in near-real time
require 'time'
require 'json'
# To prevent encoding errors on OSX
if RUBY_VERSION =~ /2.*.*/
Encoding.default_external = Encoding::UTF_8
Encoding.default_internal = Encoding::UTF_8
@sethbergman
sethbergman / xterm-256color.svg
Created April 21, 2017 06:42 — forked from jasonm23/xterm-256color.svg
Xterm 256color mode color chart, organised into sections.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sethbergman
sethbergman / index.html
Created April 23, 2017 23:15 — forked from devoncarew/index.html
Sunflower
<!-- Copyright 2011 the Dart project authors. All rights reserved.
Use of this source code is governed by a BSD-style license
that can be found in the LICENSE file. -->
<h2>Dr. Fibonacci's Sunflower Spectacular</h2>
<div>
<canvas id="canvas" width="300" height="300"></canvas>
</div>
@sethbergman
sethbergman / spa-server.js
Last active May 5, 2017 00:10 — forked from deebloo/spa-server.js
A small sample server for SPA apps with compression.
// var fallback = require('express-history-api-fallback');
// var express = require('express');
// var compress = require('compression');
// var app = express();
// var root = __dirname + '/dist';
// app.use(compress());
// app.use(express.static(root));
// app.use(fallback('index.html', { root: root }));
var myWorker = $worker().create(function () {
self.postMessage('Hello World');
});
myWorker.run().then(function (e) {
console.log(e.data); // 'Hello World'
});
@sethbergman
sethbergman / sertice.ts
Created April 27, 2017 07:05 — forked from deebloo/sertice.ts
Angular2 Service Pattern for configurability and reusability
// Standard Service Class
export class MyService {
constructor(private config) { }
}
// factory for creating new instances of the service
function createMyService(config = {}) {
return new MyService(config);
}