Skip to content

Instantly share code, notes, and snippets.

View TaylorAckley's full-sized avatar

Taylor Ackley TaylorAckley

View GitHub Profile
@djabif
djabif / slugify.pipe.ts
Last active April 12, 2023 21:34
Angular Pipe to transform a string into a slug
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({name: 'slugify'})
export class SlugifyPipe implements PipeTransform {
transform(input: string): string {
return input.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
.replace(/\-\-+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
@vitalbone
vitalbone / keystone2heroku.md
Last active January 1, 2023 23:35
Deploying KeystoneJS to Heroku

Deploying a Keystone App to Heroku

Keystone comes completely set up to install on Heroku in a couple of steps.

1. Sign up for a Heroku account and install the Heroku Toolbelt.

Log in with it and you're ready to begin. Heroku uses git to deploy a new site, so with that in mind:

2. Create a new repository on Github and then clone it.

@cvergne
cvergne / stringUtils.js
Last active March 3, 2022 20:43
Little javascript method to get initials from a name
String.prototype.getInitials = function(glue){
if (typeof glue == "undefined") {
var glue = true;
}
var initials = this.replace(/[^a-zA-Z- ]/g, "").match(/\b\w/g);
if (glue) {
return initials.join('');
}
@andrealbinop
andrealbinop / setup-modernie-vagrant-boxes.md
Last active May 28, 2023 01:54
Setup modern.ie vagrant boxes

Setup modern.ie vagrant boxes

Since modern.ie released vagrant boxes, it' no longer necessary to manually import the ova file to virtualbox, as mentioned here.

However, the guys at modern.ie didn't configured the box to work with WinRM. This how-to addresses that, presenting steps to proper repackage these boxes, adding WinRM support. Additionally configures chocolatey package manager and puppet provisioner.

Pre-requisites

@sogko
sogko / app.js
Last active November 8, 2022 12:31
gulp + expressjs + nodemon + browser-sync
'use strict';
// simple express server
var express = require('express');
var app = express();
var router = express.Router();
app.use(express.static('public'));
app.get('/', function(req, res) {
res.sendfile('./public/index.html');
@justincarroll
justincarroll / bootstrap-masonry-template.htm
Last active August 15, 2020 16:48
This is my template for using Masonry 3 with Bootstrap 3. For those of you who follow this gist a lot has changed since Bootstrap 2.
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap Masonry Template</title>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=PT+Sans+Caption:400,700">
@bespr
bespr / moment.fromNowShort.js
Created April 8, 2013 15:54
Extend moment.js to return very short words for time differences. Same as moment().fromNow, but much shorter.
/**
* A little moment js "plugin" to allow very short relative times
* NOT: "26 minutes ago"
* BUT: "26m"
*
* Usage:
* var m = moment('2013-04-08 17:50:00', 'YYYY-MM-DD HH:mm:ss');
* console.log(m.fromNow()); // -> "3 minutes ago"
* console.log(m.fromNowShort()); // -> "3m"
*
@dezinezync
dezinezync / s3.node.js
Created October 18, 2012 13:00
Node:S3 policy generator
//Code adapted from https://gist.github.com/2163005
var s3 = {
access_key_id: "<Access Key>"
, secret_key: "<Secret Key>"
, bucket: "<bucket name>"
, acl: "public-read"
, https: "false"
, error_message: ""
, pad: function(n) {
@kentbrew
kentbrew / node-on-ec2-port-80.md
Last active February 4, 2024 19:14
How I Got Node.js Talking on EC2's Port 80

The Problem

Standard practices say no non-root process gets to talk to the Internet on a port less than 1024. How, then, could I get Node talking on port 80 on EC2? (I wanted it to go as fast as possible and use the smallest possible share of my teeny tiny little micro-instance's resources, so proxying through nginx or Apache seemed suboptimal.)

The temptingly easy but ultimately wrong solution:

Alter the port the script talks to from 8000 to 80:

}).listen(80);