Skip to content

Instantly share code, notes, and snippets.

Jono Feist defaye

  • England
View GitHub Profile
javilobo8 / download-file.js
Last active Jul 10, 2020
Download files with AJAX (axios)
View download-file.js
url: 'http://localhost:5000/static/example.pdf',
method: 'GET',
responseType: 'blob', // important
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'file.pdf');
simonhamp / AppServiceProvider.php
Last active Jul 11, 2020
A pageable Collection implementation for Laravel
View AppServiceProvider.php
namespace App\Providers;
use Illuminate\Support\Collection;
use Illuminate\Pagination\LengthAwarePaginator;
class AppServiceProvider extends ServiceProvider
public function boot()
# Stop all containers
docker stop `docker ps -qa`
# Remove all containers
docker rm `docker ps -qa`
# Remove all images
docker rmi -f `docker images -qa `
# Remove all volumes
remarkablemark / Dockerfile
Last active Jul 1, 2020
Install node and npm with nvm using Docker.
View Dockerfile
# set the base image to Debian
FROM debian:latest
# replace shell with bash so we can source files
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
# update the repository sources list
# and install dependencies
RUN apt-get update \
ghinda / object-to-form-data.js
Last active Jul 4, 2020
JavaScript Object to FormData, with support for nested objects, arrays and File objects. Includes Angular.js usage.
View object-to-form-data.js
// takes a {} object and returns a FormData object
var objectToFormData = function(obj, form, namespace) {
var fd = form || new FormData();
var formKey;
for(var property in obj) {
if(obj.hasOwnProperty(property)) {
if(namespace) {
kohnmd / flatten.php
Last active Feb 8, 2019
Function to recursively flatten multidimensional PHP array.
View flatten.php
// Requires PHP 5.3+
// Found here:
function flatten_array(array $array) {
$flattened_array = array();
array_walk_recursive($array, function($a) use (&$flattened_array) { $flattened_array[] = $a; });
return $flattened_array;
nogweii / plugin.rb
Last active Aug 29, 2015
steam login plugin for discourse
View plugin.rb
# name: discourse-steam
# about: VALVE's Steam login support for Discourse
# version: 0.0.1
# authors: Colin Shea
auth_provider :title => 'with Steam',
:authenticator =>'steam','', trusted: true),
:message => 'Authenticating with Steam (make sure pop up blockers are not enabled)',
:frame_width => 1000, # the frame size used for the pop up window, overrides default
:frame_height => 800
jasonrobertfox / commit-msg
Last active Oct 31, 2018
This is a commit-msg hook for git that will validate your commit message to conform to the rules outlined in It's a ruby adaptation of the hook outlined in (Thanks Addam Hardy!)
View commit-msg
exec < /dev/tty
./.git/hooks/validate_commit.rb $1
jordelver / gist:3790808
Created Sep 26, 2012
Destructuring assignment in Ruby and splats!
View gist:3790808
# Destructuring assignment in Ruby
numbers = [ 1, 2, 3, 4, 5]
=> [1, 2, 3, 4, 5]
# Destructuring assignment
a, b, c = numbers
kinopyo / gist:2343176
Created Apr 9, 2012
Override Devise RegistrationsController, override redirect path after updating user
View gist:2343176

Override Devise RegistrationsController


Here I'll show you

  • How to override devise registrations_controller(related to create/update user account)
  • How to change redirect path after updating user

Override RegistrationsController

You can’t perform that action at this time.