Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Sean Delaney seandelaney

🏠
Working from home
View GitHub Profile
@jonlabelle
jonlabelle / string-utils.js
Last active Jul 14, 2020
Useful collection of JavaScript string utilities.
View string-utils.js
// String utils
//
// resources:
// -- mout, https://github.com/mout/mout/tree/master/src/string
/**
* "Safer" String.toLowerCase()
*/
function lowerCase(str) {
return str.toLowerCase();
@chrisjhoughton
chrisjhoughton / wait-el.js
Last active Jul 10, 2020
Wait for an element to exist on the page with jQuery
View wait-el.js
var waitForEl = function(selector, callback) {
if (jQuery(selector).length) {
callback();
} else {
setTimeout(function() {
waitForEl(selector, callback);
}, 100);
}
};
@remarkablemark
remarkablemark / Dockerfile
Last active Jul 1, 2020
Install node and npm with nvm using Docker.
View Dockerfile
# set the base image to Debian
# https://hub.docker.com/_/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 \
@jfloff
jfloff / mamp.md
Last active Jun 30, 2020
How to get MAMP to work with SSL ... Yes really.
View mamp.md

First of all you need to be able to run MAMP in port 80. This is a "heat check" if you don't have any process jamming http ports. You can check it like this:

sudo lsof | grep LISTEN

If you do happen to have any process with something like this *:http (LISTEN), you are in trouble. Before with adventure check if it isn't MAMP itself (yeah, you should close that beforehand)

ps <pid of that process>

If you don't see MAMP, you are in good hands, I have just the thing for you:

@julienbourdeau
julienbourdeau / webpack.mix.js
Created Apr 20, 2020
Laravel Mix with multiple Tailwind config and PurgeCSS (separate Admin dashboard and Front app)
View webpack.mix.js
const mix = require('laravel-mix');
const tailwindcss = require('tailwindcss');
const rootPath = Mix.paths.root.bind(Mix.paths);
const tailwindPlugins = function(configFile, paths) {
const pluginList = [tailwindcss(configFile)];
if (mix.inProduction()) {
pluginList.push(require('@fullhuman/postcss-purgecss')({
@yidas
yidas / js-encode-decode.md
Last active May 15, 2020
JavaScript HTML Entities Encode & Decode
View js-encode-decode.md
@izzygld
izzygld / Wysiwyg.vue
Created Jan 9, 2019
Adding a “show html” button in Quill (Wysiwyg).
View Wysiwyg.vue
<template>
<div>
<vue-editor v-model="content" ref="editor" :editor-options="toolbarOptions" @text-change="updateValue" useCustomImageHandler @imageAdded="uploadImage"></vue-editor>
</div>
</template>
<script>
import Vue from "vue";
import axios from 'axios'
let VueEditor, Quill;
@yidas
yidas / js-nl2br-br2nl.md
Last active Apr 1, 2020
JavaScript nl2br & br2nl functions
View js-nl2br-br2nl.md

JavaScript nl2br & br2nl functions

The exchange of new line & br HTML tag could refer to PHP - nl2br() function, which uses to inserts HTML line breaks before all newlines in a string.

These JavaScript functions consider whether to use insert or replace to handle the swap.

nl2br

View webpack.config.js
let webpack = require('webpack');
let path = require('path');
module.exports = {
entry: {
app: './resources/assets/js/app.js',
vendor: ['vue', 'axios']
},
output: {
@oslego
oslego / gist:f13e136ffeaa6174289a
Last active Jan 3, 2019 — forked from sl4m/gist:5091803
create self-signed certificate for localhost
View gist:f13e136ffeaa6174289a
# SSL self signed localhost for rails start to finish, no red warnings.
# 1) Create your private key (any password will do, we remove it below)
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
You can’t perform that action at this time.