Skip to content

Instantly share code, notes, and snippets.

View paschaldev's full-sized avatar
🏠
Working from home

Paschal Ezeugwu paschaldev

🏠
Working from home
View GitHub Profile
@kez
kez / slugify.sql
Created May 13, 2019 14:50 — forked from ianks/slugify.sql
Generating Slugs in Postgres
CREATE EXTENSION IF NOT EXISTS "unaccent"
CREATE OR REPLACE FUNCTION slugify("value" TEXT)
RETURNS TEXT AS $$
-- removes accents (diacritic signs) from a given string --
WITH "unaccented" AS (
SELECT unaccent("value") AS "value"
),
-- lowercases the string
"lowercase" AS (

How we incorporate next and cloudfront (2018-04-21)

Feel free to contact me at robert.balicki@gmail.com or tweet at me @statisticsftw

This is a rough outline of how we utilize next.js and S3/Cloudfront. Hope it helps!

It assumes some knowledge of AWS.

Goals

@kottenator
kottenator / simple-pagination.js
Created July 13, 2015 20:44
Simple pagination algorithm
// Implementation in ES6
function pagination(c, m) {
var current = c,
last = m,
delta = 2,
left = current - delta,
right = current + delta + 1,
range = [],
rangeWithDots = [],
l;
@danharper
danharper / BaseCollection.php
Created January 24, 2014 12:34
Laravel/Eloquent Collection method to sort by a comma-separated string of IDs. Any models which do not appear in the given order are added to the end in ID order.
<?php
use Illuminate\Database\Eloquent\Collection;
class BaseCollection extends Collection {
public function sortByOrder($order, $delimeter = ',')
{
$order = is_array($order) ? $order : explode($delimeter, $order);