Skip to content

Instantly share code, notes, and snippets.

doSomething(elements);
function doSomething(elements, i) {
// For first iteration
if(i === undefined) i = 0;
var element = elements[i];
$.ajax({
@flackend
flackend / CDPATH.md
Last active February 22, 2022 21:57
Instructions for setting up CDPATH completions on Mac.

CDPATH

Overview

This will allow you to include additional directories to what cd will look at for completions. From the bash man page:

The search path for the cd command. This is a colon-separated list of directories in which the shell looks for destination directories specified by the cd command.

Usage

@flackend
flackend / script.js
Created November 18, 2013 16:57
JavaScript files starter
;(function (window, document, $, undefined) {
$(function() {
"use strict";
});/* on document ready */
})(this, this.document, jQuery);
@flackend
flackend / SSH.md
Last active December 30, 2015 07:49

SSH

You can read about SSH in the man page, man ssh, and the SSH config man page, man ssh_config.

When you have issues, make sure to use the verbose flag, -v.

Password login

If you don't have any public keys in your user's .ssh folder (i.e. /home/jared/.ssh/), you should be able to login without designating any options:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title></title>
<style>@import url('http://getbootstrap.com/2.3.2/assets/css/bootstrap.css');</style>
<style>body { padding-top: 10px }</style>
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>

DB Design performance tips and tricks


  • Learn from smarties
  • Evangelize good DB design (which in turn helps you solidify your own knowledge)
  • Talk to business people
  • Benchmark your queries to determine the fastest

@flackend
flackend / Redirect After Session Expires.md
Last active October 20, 2018 12:44
Example solution to handling re-authentication after session expires for AJAX requests.

When a user's session expires and they're on a page that uses ajax requests, you need to set up something to gracefully handle reauthenticating. In this example, we prompt the user and redirect them to the login page.

demo

For Laravel, in your auth filter:

<?php
Route::filter('auth', function()
{
@flackend
flackend / README.md
Last active August 29, 2015 14:07 — forked from jonathantneal/README.md

Local SSL websites on Mac OSX

These instructions will guide you through the process of setting up local, trusted websites on your own computer.

These instructions are intended to be used on Mac OSX Yosemite.


Configuring Apache

# Tail Laravel and Webserver (NGINX & Apache 2) log files
# Compatible with Laravel 4 & 5
#
alias tl="ls -d /var/log/nginx/* /var/log/apache2/* storage/logs/* app/storage/logs/* storage/laravel.log | grep -v 'gz$' | grep -v '1$' | xargs tail -f"