Skip to content

Instantly share code, notes, and snippets.

View poteto's full-sized avatar
🥔
ポテト

lauren poteto

🥔
ポテト
View GitHub Profile
@poteto
poteto / ddd.md
Created February 23, 2017 07:10 — forked from zsup/ddd.md
Documentation-Driven Development (DDD)

Documentation-Driven Development

The philosophy behind Documentation-Driven Development is a simple: from the perspective of a user, if a feature is not documented, then it doesn't exist, and if a feature is documented incorrectly, then it's broken.

  • Document the feature first. Figure out how you're going to describe the feature to users; if it's not documented, it doesn't exist. Documentation is the best way to define a feature in a user's eyes.
  • Whenever possible, documentation should be reviewed by users (community or Spark Elite) before any development begins.
  • Once documentation has been written, development should commence, and test-driven development is preferred.
  • Unit tests should be written that test the features as described by the documentation. If the functionality ever comes out of alignment with the documentation, tests should fail.
  • When a feature is being modified, it should be modified documentation-first.
  • When documentation is modified, so should be the tests.
@poteto
poteto / FBGroupMemberRemover.js
Last active September 11, 2019 17:49
Delete everyone from your Facebook group! Thanks for the dark UX, FB
class FBGroupMemberRemover {
constructor() {
this.adminText = 'Admin';
this.removeMemberModalHeadingText = 'Remove Member';
this.memberElementSelector = '[data-name="GroupProfileGridItem"]';
this.memberContextMenuSelector = 'button[aria-label="Member Settings"]';
this.removeMemberButtonSelector = 'a[data-testid="leave_group"]'
this.removalOptions = {
@poteto
poteto / mark-empty-as-busy.js
Created February 24, 2019 05:40
WIP: Create busy placeholders in GCal
function toDateRanges(items) {
return items
.filter(calEvent => {
return (
calEvent.start &&
calEvent.start.dateTime &&
calEvent.end &&
calEvent.end.dateTime
);
})
@poteto
poteto / generate-random-dates.js
Last active February 18, 2019 23:28
Quick and dirty script to generate some random dates. Copy/paste into your console, it will copy those dates into your clipboard.
const COUNT = 32;
const START_DATE = new Date(2019, 0, 1);
const END_DATE = new Date(2019, 11, 31);
function randomDate(start, end) {
return new Date(
start.getTime() + Math.random() * (end.getTime() - start.getTime())
);
}
@poteto
poteto / controllers.application.js
Last active September 14, 2018 16:40
nuked parent route
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@poteto
poteto / controllers.application.js
Created October 11, 2017 17:47
route loading jank
import Ember from 'ember';
export default Ember.Controller.extend({
queryParams: ['greeting'],
greeting: 'Hallo'
});
@poteto
poteto / devise-oauth.md
Created September 15, 2012 15:38
[rails] using devise and oauth

Rails user authentication using Devise and Omniauth (OAuth). (Note that the Dropbox API uses OAuth v1)

First in Gemfile:

gem 'devise'
gem 'omniauth'
gem 'omniauth-dropbox'
@poteto
poteto / flatten_nested_json.ex
Last active April 20, 2018 16:52
Flatten deeply nested Map in Elixir
defmodule Json do
def flatten(%{} = json) do
json
|> Map.to_list()
|> to_flat_map(%{})
end
def flatten(%{} = json) when json == %{}, do: %{}
defp to_flat_map([{_k, %{} = v} | t], acc), do: to_flat_map(Map.to_list(v), to_flat_map(t, acc))
defp to_flat_map([{k, v} | t], acc), do: to_flat_map(t, Map.put_new(acc, k, v))
@poteto
poteto / gas_sheet_as_json.js
Created March 29, 2018 22:05 — forked from chrsstrm/gas_sheet_as_json.js
Treat a Google Sheet like a JSON API
/**
* create a Google Sheet then go to Tools > Script Editor
* Paste this code into the editor. Save.
* Publish > Deploy as Web App
* Set new version, publish as me, who has access - anyone, even anon.
* GET to the URL, add on end ?sheet=[sheet name]
* Sheet name is the sheet name, manage appropriately (no spaces or symbols to keep it simple)
* Request returns JSON representation of the sheet.
*/
@poteto
poteto / controllers.application.js
Last active December 27, 2017 09:08
changeset es6 proxy
import Ember from 'ember';
import Changeset from '../lib/changeset';
import validatePresence from '../validators/presence';
let model = { foo: 'bar' };
let validations = {
foo: validatePresence()
};
let changeset = new Changeset(model, { validations });