Skip to content

Instantly share code, notes, and snippets.

View dylanhthomas's full-sized avatar

Dylan Thomas dylanhthomas

View GitHub Profile

To quickly and easily remove all unwanted comments when using Sublime text, perform a search and replace (CMD, ALT & D) and enter the following. Make sure that regex search is enabled by clicking the small icon in the bottom left that looks like an astrix.

For example, to remove all HTML comments:

(?s)<!--.*?-->

search and replace with blank

Or to remove all CSS comments:

@adamreisnz
adamreisnz / package.json
Last active January 19, 2024 13:01
Simple pure npm scripts build process
{
"name": "project-name",
"description": "Template for static sites",
"version": "1.0.0",
"homepage": "http://www.project-name.com",
"author": {
"name": "Adam Reis",
"url": "http://adam.reis.nz"
},
"license": "UNLICENSED",
@digisavvy
digisavvy / new_gist_file.php
Created May 5, 2015 19:45
Ninja Forms Filter
// Pre-Populate Talent Inquiry Form
function digisavvy_pre_pop_talent_title( $data, $field_id ){
global $ninja_forms_processing;
// Get the current form_id
$form_id = $ninja_forms_processing->get_form_ID(); // Gets the ID of the form we are currently processing.
// If the form_id is the form we want
if( $form_id == 5 ){
if( $field_id == 3 ){
$data['default_value'] = get_the_title();
}
@marcojetson
marcojetson / jquery.scrolldirection.js
Created January 16, 2014 15:59
jQuery - Adds scroll direction to scroll event
(function ($) {
"use strict";
var wnd = $(window),
lastScrollTop = wnd.scrollTop(),
lastScrollLeft = wnd.scrollLeft();
wnd.on("scroll", function (event) {
var scrollTop = wnd.scrollTop(),
scrollLeft = wnd.scrollLeft(),
@steinar
steinar / gist:7927413
Created December 12, 2013 12:46
Time-tracking shell command: What are you doing right now? alias less8='LESSCHARSET="UTF-8" less'
#!/usr/bin/python
import sys
from datetime import datetime
when = datetime.now().isoformat(' ').split('.')[0]
what = " ".join(sys.argv[1:])
line = "%s | %s\n" % (when, what)
f = open("/Users/steinar/doing.log", "a")
f.writelines([line])
@andphe
andphe / gist:3232343
Created August 2, 2012 01:41
Export your links from Safari reading list
/usr/bin/plutil -convert xml1 -o - ~/Library/Safari/Bookmarks.plist | grep -E -o '<string>http[s]{0,1}://.*</string>' | grep -v icloud | sed -E 's/<\/{0,1}string>//g'