Skip to content

Instantly share code, notes, and snippets.

View tommydunn's full-sized avatar
🖖

Tommy Dunn tommydunn

🖖
View GitHub Profile
@mrispoli24
mrispoli24 / setting-up-heroku-and-cloudflare.md
Created October 15, 2018 18:41
Setting up Heroku and Cloudflare (the right way)

Setting up Heroku and Cloudflare (the right way)

The following outlines how to setup Heroku + Cloudflare with a full SSL certificate. What this means is that communication between the browser and the Cloudflare CDN is encrypted as well as communication between Cloudflare and Heroku’s origin server. Follow these steps exactly and the setup is a breeze.

Step 1: Set up domain names in Heroku

First you want to add the root domain and the www domain to heroku. You do this by clicking into your production application, then going to settings and then scrolling down to Domains and certificates.

Here you will add <your_domain>.com and www.<your_domain>.com. This will give you two CNAME records. They will look something like <your_domain>.com.herokudns.com and www.<your_domain>.com.herokudns.com.

Step 2: Add CNAME records to Cloudfare.

@j1mc
j1mc / bulma-sass-scss.rb
Last active August 14, 2023 05:04 — forked from DanyHenriquez/bulma-sass-scss.rb
Convert bulma from sass to scss
#!/usr/bin/env ruby
require 'tmpdir'
require 'fileutils'
dir = Dir.tmpdir()
if File.directory?("#{dir}/bulma")
FileUtils.remove_dir("#{dir}/bulma")
end
@inorganik
inorganik / email-subscribe-form.component.ts
Last active July 4, 2025 08:33
MailChimp subscribe form with Angular 5 using jsonp
import { Component } from '@angular/core';
import { FormControl, Validators } from '@angular/forms';
import { HttpClient, HttpParams } from '@angular/common/http';
interface MailChimpResponse {
result: string;
msg: string;
}
@Component({
@tommydunn
tommydunn / _A-interpolation.scss
Last active March 14, 2024 00:05
Sass Mixin's for Fluid Type
@mixin interpolate($properties, $min-screen, $max-screen, $min-value, $max-value) {
& {
@each $property in $properties {
#{$property}: $min-value;
}
@media screen and (min-width: $min-screen) {
@each $property in $properties {
#{$property}: calc-interpolation($min-screen, $min-value, $max-screen, $max-value);
}
@djabif
djabif / slugify.pipe.ts
Last active July 18, 2025 09:54
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
@tommydunn
tommydunn / index.html
Last active January 29, 2018 15:24
Responsive Ratio-Based Typography SASS Mixin
<h1>Responsive Ratio-Based Typography SASS Mixin</h1>
<hr>
<h2>How it works:</h2>
<p>This SASS Mixin takes one parameter: font size. When the mixin is used in conjunction with media queries you can easily make intricate responsive typographical styles very quickly.</p>
<h3>How to use it:</h3>
<code>
<pre>
//0px - first breakpoint:
@urkopineda
urkopineda / content.component.css
Last active January 9, 2023 15:12
Masonry implementation in Angular 2+ only with JS and CSS, ordered horizontaly
.card-img-overlay-gradient {
background: linear-gradient(to bottom, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0));
}
.flex-container {
display: grid;
grid-gap: 10px;
grid-template-columns: repeat(auto-fill, minmax(250px,1fr));
grid-auto-rows: 20px;
}
.flex-item {}
@devinsays
devinsays / example-ajax-enqueue.php
Last active March 5, 2026 14:32
Simple WordPress Ajax Example
<?php
function example_ajax_enqueue() {
// Enqueue javascript on the frontend.
wp_enqueue_script(
'example-ajax-script',
get_template_directory_uri() . '/js/simple-ajax-example.js',
array( 'jquery' )
);
@ibraheem4
ibraheem4 / postgres-brew.md
Last active May 4, 2026 04:03
Installing Postgres via Brew (OSX)

Installing Postgres via Brew

Pre-Reqs

Brew Package Manager

In your command-line run the following commands:

  1. brew doctor
  2. brew update
@rniswonger
rniswonger / fluid-text.scss
Last active April 19, 2024 14:39
Sass Mixin: Fluid Text
// fluidly resize type
// based on example here https://css-tricks.com/snippets/css/fluid-typography/
@mixin fluid-type($font-min, $font-max, $screen-min, $screen-max) {
font-size: #{$font-min}px;
@media only screen and (min-width: #{$screen-min}px) {
font-size: calc(
#{$font-min}px + #{($font-max - $font-min)} * (100vw - #{$screen-min}px) / (#{$screen-max} - #{$screen-min})
);
}