Skip to content

Instantly share code, notes, and snippets.

Dave Stevens davestevens

  • Leicester, UK
Block or report user

Report or block davestevens

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
davestevens / download-images-from-google-drive.js
Last active Sep 22, 2019
Download images from Google Drive folder using Node.js Google library
View download-images-from-google-drive.js
var google = require("googleapis"),
drive ="v2"),
fs = require("fs");
var config = {
"client_id": "client_id",
"client_secret": "client_secret",
"scope": "scope",
"redirect_url": "redirect_rul",
"tokens": {
davestevens /
Last active Aug 12, 2019
Let’s Encrypt setup for Apache, NGINX & Node.js

Let's Encrypt

Examples of getting certificates from Let's Encrypt working on Apache, NGINX and Node.js servers.

Obtain certificates

I chose to use the manual method, you have to make a file available to verify you own the domain. Follow the commands from running

git clone
cd letsencrypt
View replaceState.html
Opening this in the latest Chrome (Version 45.0.2454.85) results in an error
"Uncaught SecurityError: Failed to execute 'replaceState' on 'History'"
This has only just stated happening this afternoon and doesn't cause an issue on older versions of Chrome
<!DOCTYPE html>
<title>Testing replaceState</title>
davestevens / Controller.php
Created Apr 3, 2015
Displays all Database Queries in Laravel 5
View Controller.php
<?php namespace App\Http\Controllers;
use Illuminate\Foundation\Bus\DispatchesCommands;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Log;
use DB;
abstract class Controller extends BaseController {
davestevens / slack_notify.rake
Created Feb 18, 2015
Capistrano Slack integration.
View slack_notify.rake
# Capistrano Task that hooks into `deploy:finished` to send a message to Slack
# 1. Setup a Slack Incoming Webhook Integration (
# 2. Put the Webhook URL in an Environment variable (SLACK_WEBHOOK_URL)
# 3. Place this file in `lib/capistrano/tasks`
# This will then create a new message in the channel on deployment, including who, what and where information
require "net/http"
require "json"
View Gemfile
source ""
gem "bcrypt"
View inject_vs_each_with_object.rb
#!/usr/bin/env ruby
inputs = [[1,2,3], [2,4,6], [1,3,5]]
inject_output = inputs.inject([]) do |memo, input|
memo |= input
each_with_object_output = inputs.each_with_object([]) do |input, memo|
davestevens / index.html
Created Sep 18, 2014
Scroll Issue in Chrome at 110% zoom
View index.html
<!DOCTYPE html>
<title>Scroll Test</title>
.wrapper {
height: 40px;
width: 400px;
overflow: auto;
davestevens / client.rb
Last active Aug 29, 2015
OAuth2 with Refresh Token
View client.rb
require "oauth2"
require_relative "token"
module Api
class Client
def initialize(client_id:, client_secret:, endpoint:)
@client_id = client_id
@client_secret = client_secret
@endpoint = endpoint
View gist:ce1db5334ca06c487d39
<!DOCTYPE html>
.vertically_align {
width: 256px;
height: 256px;
overflow: hidden;
You can’t perform that action at this time.