Skip to content

Instantly share code, notes, and snippets.

View s-taylor's full-sized avatar

Simon Taylor s-taylor

View GitHub Profile
@s-taylor
s-taylor / example.js
Last active September 22, 2017 05:33
Understanding async await - part 3
await Promise.reject(new Error('Boom'));
@s-taylor
s-taylor / example.js
Last active September 27, 2017 22:22
Understanding async await - part 2
someAsyncThing()
.then(result => { ... })
@s-taylor
s-taylor / example.js
Created September 22, 2017 05:27
Understanding async await - part 1
const result = await someAsyncThing();
@s-taylor
s-taylor / time-walk-vs-rrule.md
Created June 10, 2017 23:39
How does Time Walk differ to Rrule

How does Time Walk differ to Rrule?

Timezone Support

The largest issue I have with Rrule is that it has no real timezone support. Dates are always generated based off the timezone of your machine/server. I want the same functionality but with the ability to specify what timezone the resulting dates should be in.

Leverage Moment

I also wanted to see if it was possible to make a much more lightweight library. For the most part moment-timezone already handles the complex logic of adding months, weeks, days to a date, so why not leverage that for date logic?

Enforce Rule Start Dates

import time
import requests
import json
class DownloadStationAPI():
def __init__(self, host=None, username=None, password=None):
self.name = 'DownloadStation'

Keybase proof

I hereby claim:

  • I am s-taylor on github.
  • I am nizmox (https://keybase.io/nizmox) on keybase.
  • I have a public key whose fingerprint is C9AE D384 A4F6 49BE 9E3F F92F 9064 A3DA ABD5 7A0B

To claim this, I am signing this object:

@s-taylor
s-taylor / sublime_text_snippets.md
Last active August 29, 2015 13:57
Sublime Text 2 Snippets

#Snippet Instructions...


##Create a new Snippet

  1. Tools > New Snippet...

  2. Put your code in here (don't delete the cdata tags)...

#Make sure the postgres App is running on computer
#Carrierwave works with ORM such as Active Record and Datamapper;
rails new carrier_wave_app -d postgresql
add production and development database to database.yml #make sure you do not add one of the fields to production
rails g scaffold art_galleries name:string location:string avatar:text #Also create the table in migrations folder;
#Is it added to the protected attributes method in the controller;
#Add root_to in the config.routes;
gem 'carrierwave'
rails generate uploader Avatar #Give you a class in app/uploaders/avatar_uploader.rb
rails g migration add_avatar_to_art_galleries avatar:string

PAPER - work out what form all of your data will take- tables and field names

TERMINAL - rails new NAME -d postgresql

TERMINAL - cd into that NAME folder and subl .

SUBL - open your gemfile and add all the extra gems you want

TERMINAL - bundle

@s-taylor
s-taylor / rails_notes.md
Last active August 29, 2015 13:57
Rails Notes

Current as at 18-MAR-2014

#Rails Notes


###HTTP Requests###

Contains… GET

  • domain