Skip to content

Instantly share code, notes, and snippets.

@thibaudgg
thibaudgg / tutorial.md
Last active January 23, 2023 05:38
Rails Authentication from Scratch - Step by Step

Rails Authentication from Scratch - Step by Step

Prerequisites

  • Clone the Cloud9 thibaudgg/rails-weblog workspace. Go to https://c9.io/new/clone and then choose the "MAS-RAD / Ruby on Rails" team, click on the "Clone workspace" tab, then choose the "thibaudgg/rails-weblog" workspace.
  • Seed the database, this will create some posts and comments (see db/seeds.rb):
rails db:seed
@simonhamp
simonhamp / AppServiceProvider.php
Last active August 4, 2025 20:56
A pageable Collection implementation for Laravel
<?php
namespace App\Providers;
use Illuminate\Support\Collection;
use Illuminate\Pagination\LengthAwarePaginator;
class AppServiceProvider extends ServiceProvider
{
public function boot()
@hartleybrody
hartleybrody / import-db.sh
Last active December 3, 2025 20:20
Copy data from Heroku Postgres into local database
# copy/import data from heroku postgres to localhost pg database
# useful for copying admin's work on live site into local database to reproduce errors
# https://devcenter.heroku.com/articles/heroku-postgres-import-export
# take heroku pg snapshot and download
heroku pg:backups:capture
heroku pg:backups:download
# load the dump into local postgres database, assuming $DATABASE_URL set locally
@asessa
asessa / StrPad.go
Created September 6, 2016 22:48
golang padding strings
package util
import (
"math"
"strings"
)
// StrPad returns the input string padded on the left, right or both sides using padType to the specified padding length padLength.
//
// Example:
@leonardofed
leonardofed / README.md
Last active May 26, 2026 06:57
A curated list of AWS resources to prepare for the AWS Certifications


A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.


==========================
How Software Companies Die
==========================
- Orson Scott Card
The environment that nurtures creative programmers kills management and
marketing types - and vice versa.
Programming is the Great Game. It consumes you, body and soul. When
you're caught up in it, nothing else matters. When you emerge into
@mdang
mdang / RAILS_CHEATSHEET.md
Last active April 16, 2026 18:51
Ruby on Rails Cheatsheet

Ruby on Rails Cheatsheet

Architecture

Create a new application

Install the Rails gem if you haven't done so before

@jaymecd
jaymecd / golang-auto-build-versioning.md
Last active January 6, 2025 22:43
Golang Auto Build Versioning
go run -ldflags "-s \
  -X main.Version=1.0.2 \
  -X main.BuildTime=`TZ=UTC date -u '+%Y-%m-%dT%H:%M:%SZ'` \
  -X main.GitHash=`git rev-parse HEAD`" \
  myapp.go

Adopted from www.atatus.com

@alfredoem
alfredoem / pdf-example.blade.php
Created November 3, 2015 19:17
Template for a invoice render with DomPDF
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Aloha!</title>
<style type="text/css">
* {
font-family: Verdana, Arial, sans-serif;
}
@mcaskill
mcaskill / Function.Array-Group-By.php
Last active October 21, 2025 08:41
PHP : Groups an array by a given key
<?php
if (!function_exists('array_group_by')) {
/**
* Groups an array by a given key.
*
* Groups an array into arrays by a given key, or set of keys, shared between all array members.
*
* Based on {@author Jake Zatecky}'s {@link https://github.com/jakezatecky/array_group_by array_group_by()} function.
* This variant allows $key to be closures.