Skip to content

Instantly share code, notes, and snippets.

View jameslutley's full-sized avatar
🎯
Focusing

James Lutley jameslutley

🎯
Focusing
View GitHub Profile
@manavsehgal
manavsehgal / webpack.lint.config.js
Created May 24, 2016 11:03
Webpack configuration for running Browsersync, ESLint and StyleLint along with Hot Reloading
// Initialization
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const postcssImport = require('postcss-easy-import');
const BrowserSyncPlugin = require('browser-sync-webpack-plugin');
const path = require('path');
const StyleLintPlugin = require('stylelint-webpack-plugin');
const APP = path.join(__dirname, 'app');
@robinrendle
robinrendle / browsersync-webpack.md
Last active November 7, 2025 05:31
Getting set up with Browsersync and Webpack

Fixing our local environment with Browsersync

Whenever we change our templates we still have to use our build script and this can get annoying. Thankfully with webpack-dev-server and BrowserSync we can fix this:

npm i -D browser-sync browser-sync-webpack-plugin webpack-dev-server

BrowserSync will act like a proxy, waiting for webpack to do its thing and then reloading the browser for us.

Here's how to make jQuery DataTables work with npm and webpack. DT checks for AMD compatibility first
which breaks when you're using CommonJS with webpack.
Install DT core: npm install datatables.net
Install a DT style: npm install datatables.net-bs (bootstrap)
Install the imports-loader webpack plugin: https://github.com/webpack/imports-loader#disable-amd
Create a loader "exception" just for DT in webpack.config.js:
module: {
loaders: [
@philipstanislaus
philipstanislaus / sane-caching.nginx.conf
Last active October 29, 2025 07:28
Sample Nginx config with sane caching settings for modern web development
# Sample Nginx config with sane caching settings for modern web development
#
# Motivation:
# Modern web development often happens with developer tools open, e. g. the Chrome Dev Tools.
# These tools automatically deactivate all sorts of caching for you, so you always have a fresh
# and juicy version of your assets available.
# At some point, however, you want to show your work to testers, your boss or your client.
# After you implemented and deployed their feedback, they reload the testing page – and report
# the exact same issues as before! What happened? Of course, they did not have developer tools
# open, and of course, they did not empty their caches before navigating to your site.
@haydenbleasel
haydenbleasel / dribbble.html
Last active April 27, 2016 13:45
Dribbble feed for portfolio
#dribbble
.row.clearfix.hidden-xs
noscript Sorry, you need Javascript enabled to view these Dribbble shots.
.column-3
p Simplicity, functionality and accessibility will always remain at the core of my philosphy. I like to combine aspects of print and graphic such as dynamic layouts and typographic flourishes with the principles of modern, minimalism.
@Markvandersteen
Markvandersteen / image.js
Last active January 14, 2020 04:20
Simple Express image route upload for CKEditor with multer middleware
multer = require('multer');
var storage = multer.diskStorage({
destination: function (req, file, cb) {
cb(null, 'public/uploads/images/')
}
});
var upload = multer({ storage: storage });
module.exports = function (app) {
@hsleonis
hsleonis / better-font-smoothing.css
Last active January 12, 2025 12:26
Better font smoothing in cross browser
html {
/* Adjust font size */
font-size: 100%;
-webkit-text-size-adjust: 100%;
/* Font varient */
font-variant-ligatures: none;
-webkit-font-variant-ligatures: none;
/* Smoothing */
text-rendering: optimizeLegibility;
-moz-osx-font-smoothing: grayscale;
@dannyvassallo
dannyvassallo / 20160216211105_create_images.rb
Created February 16, 2016 21:32
Use tinymce-rails & tinymce-rails-imageupload with carrierwave & fog
# db/migrate/filename.rb
# generate with >> rails g model image alt:string hint:string file:string
class CreateImages < ActiveRecord::Migration[5.0]
def change
create_table :images do |t|
t.string :alt
t.string :hint
t.string :file
@sethbergman
sethbergman / WP-HTML-Compression
Created November 3, 2015 03:27
Minify HTML for WordPress without a Plugin - Add to function.php
<?php
class WP_HTML_Compression
{
// Settings
protected $compress_css = true;
protected $compress_js = true;
protected $info_comment = true;
protected $remove_comments = true;
// Variables
$ npm -g install localtunnel
/usr/local/bin/lt -> /usr/local/lib/node_modules/localtunnel/bin/client
[email protected] /usr/local/lib/node_modules/localtunnel
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected] ([email protected], [email protected], [email protected], [email protected])
$ lt --port 8080
your url is: https://htkzpnysxf.localtunnel.me