Skip to content

Instantly share code, notes, and snippets.

View zacwasielewski's full-sized avatar

Zac Wasielewski zacwasielewski

View GitHub Profile
@nepsilon
nepsilon / 2-front-end-tips-to-keep-in-mind.md
Last active December 2, 2016 09:34
2 front-end tips to keep in mind — First published in fullweb.io issue #68

2 front-end tips to keep in mind

1. Stop using .innerHTML = ''; when removing children to a DOM element.

On modern browsers it seems to be about 400× (!!) slower than this DOM-friendly method:

while (el.firstChild)
    el.removeChild(el.firstChild);
@nepsilon
nepsilon / pg-backup.md
Last active November 21, 2017 00:27
Proper way to do backup (and restore!) with PostgreSQL 🐘 — First published in fullweb.io issue #51

Proper way to do backup (and restore!) with PostgreSQL 🐘

Postgres provides us several options to do backup just like we want. I’ve tried several strategies in the past, and here is the one I stick to now, for both its simplicity and efficiency.

Backup your database with:

# This is using Postgres custom format
pg_dump -Fc dbname > filename
# config/routes.rb
resources :documents do
scope module: 'documents' do
resources :versions do
post :restore, on: :member
end
resource :lock
end
end
@erichurst
erichurst / US Zip Codes from 2013 Government Data
Created December 9, 2013 23:00
All US zip codes with their corresponding latitude and longitude coordinates. Comma delimited for your database goodness. Source: http://www.census.gov/geo/maps-data/data/gazetteer.html
This file has been truncated, but you can view the full file.
ZIP,LAT,LNG
00601,18.180555, -66.749961
00602,18.361945, -67.175597
00603,18.455183, -67.119887
00606,18.158345, -66.932911
00610,18.295366, -67.125135
00612,18.402253, -66.711397
00616,18.420412, -66.671979
00617,18.445147, -66.559696
00622,17.991245, -67.153993
@nikolov-tmw
nikolov-tmw / multiple-roles-per-user.php
Last active October 5, 2021 03:56
Multiple roles per user WordPress plugin.
<?php
/**
* Plugin Name: Multiple Roles per User
* Description: Allows anyone who can edit users to set multiple roles per user. In a default WordPress environment that wouldn't have much of an effect, since the user would have the privileges of the top-privileged role that you assign to him. But if you have custom roles with custom privileges, this might be helpful.
* Version: 1
* Author: nikolov.tmw
* Author URI: http://paiyakdev.com/
* License: GPL2
*/
/*
@madalinignisca
madalinignisca / gravityforms.css
Last active November 14, 2019 02:30
Gravity forms default styles and built in classes that can be used when creating forms with this plugin Maintained from http://www.gravityhelp.com/documentation/page/Design_and_Layout Use it to style Gravity Forms like a boss :)
/****************************************************************************
*** Gravity styles ***
****************************************************************************/
/*Form Body
contains the main form content*/
body .gform_wrapper .gform_body {border: 1px solid red}
/*Form List Container
unordered list used to structure all of the form elements*/
@bhubbard
bhubbard / reset-idxbroker-widgets.css
Last active August 11, 2021 10:57
A starting css template for IDX Broker
/* -------------------------------------------------------- */
/* IDX BROKER WIDGET RESETS */
/* -------------------------------------------------------- */
/* SHOWCASE WIDGET
----------------------------------------------------------- */
.IDX-showcaseTable {
max-width: 100% !important;
}
.IDX-showcaseCell {
@aras-p
aras-p / preprocessor_fun.h
Last active May 23, 2024 08:26
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
@lukecanvin
lukecanvin / backbone.localCache.js
Created July 20, 2012 08:56
Online/offline syncing for Backbone
Backbone.serverSync = Backbone.sync;
Backbone.pingUrl = '/Ping';
Backbone.localID = function() {
var localID = (localStorage.localID ? parseInt(localStorage.localID) : 0);
localID++;
localStorage.localID = localID.toString()
return -localID;
}