Skip to content

Instantly share code, notes, and snippets.

@jackvial
jackvial / gist:36d5f6b4b7f3f6189c01
Created January 19, 2015 12:49
Install ODBC on Ubuntu 14.04
http://www.kaffeetalk.de/how-to-setup-and-configure-mysql-with-unixodbc-under-ubuntu-14-04/
@jackvial
jackvial / apache2-vhosts.md
Created February 19, 2015 18:11
Ubuntu Apache2 V-hosts Configuration

How to configure an Apache2 virtual host on Ubuntu 14.10

  1. Create a new v-host directive /etc/apache2/sites-available
  2. Add the site to /etc/hosts
  3. Enable the site with sudo a2ensite mysite.com
@jackvial
jackvial / gist:95b02309ddfbf19bc62d
Last active April 2, 2016 20:46
Laravel Homestead 502 badgate fix
wrote this up here a bit ago. See step 13. The rest of it may be useful to others as well:
https://laracasts.com/discuss/channels/general-discussion/homestead-with-php7
The tl;dr is that you need to edit your nginx config.
sudo nano /etc/ngingx/sites-enabled/whatever-you-call-your-app.com and change:
fastcgi_pass unix:/var/run/php5-fpm.sock;
To
MySql should be fine after the update.
Your apache config will be overwritten but the old previous will still be there as httpd.conf~previous and httpd.conf.pre-update.
Using httpd.conf~previous worked for me.
@jackvial
jackvial / what-forces-layout.md
Created February 6, 2017 19:56 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
@jackvial
jackvial / repo-proposal.md
Created June 27, 2017 19:42 — forked from thewinterwind/repo-proposal.md
Proposal for service platform and repository pattern

Service Platform w/ Repository Pattern Proposal

This document will outline a proposal for a service platform (API) and a repository pattern as a business layer for IC.

Benefits

  • Have a data layer that is independent of models and controllers.
  • Have repo methods that can be consumed from other parts of the web application and from the command line.
  • Reduce logic in controllers and models, allowing controllers to focus on HTTP level work (request data, cookies, responses) and models to focus on creating relationships, casting columns, mutators, etc. The controllers should instead delegate work to the repos.
  • Repository methods can be reused by different parts of the web application and to perform work for an API request coming from outside (i.e. if we use a mobile platform like React Native it can call the API endpoints which in turn consume the repositories)
  • Have repo methods be easily unit tested as they will not be accessing session data, request data or external constants. They only
@jackvial
jackvial / ecdf.py
Last active October 8, 2017 00:41
Python ECDF
def ecdf(data):
"""Compute ECDF for a one-dimensional array of measurements."""
# Number of data points: n
n = len(data)
# x-data for the ECDF: x
x = np.sort(data)
# y-data for the ECDF: y
@jackvial
jackvial / postgres-setup.md
Last active November 10, 2022 21:25
Laravel Postgres Setup

Postgres Setup

Step 1: Install PostgreSQL

Here are the installation steps on Ubuntu (this installation will also work on any Debian-based distribution):

  1. Open a terminal window.
  2. Issue the command sudo apt-get install postgresql.
  3. Type the sudo password necessary to give you admin rights and hit Enter.
  4. Allow apt to pick up any necessary dependencies.
@jackvial
jackvial / NewMessage.php
Created February 13, 2018 14:53 — forked from sebastiaanluca/NewMessage.php
Laravel + Redis + NodeJS + Socket.io pub/sub secure server and client supporting multiple rooms, channels, users, … Add `client.js` to your client app, run `node server.js`, and trigger the Laravel event any way you want to broadcast the data.
<?php
namespace App\Events;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Queue\SerializesModels;
class NewMessage extends Event implements ShouldBroadcast
{
@jackvial
jackvial / gist:991ec75ab0e95fb7499d6f18a39b4982
Created February 22, 2018 16:50 — forked from tobek/get-image-urls.js
Save images from chrome inspector network tab
/* right click on an entry in the network log, select Copy All as Har
* type in console: x = [paste]
* paste the following JS code into the console
* copy the output, paste into a file
* then wget -i [that file]
*/
(function(logObj, mime) {
var results = [];
logObj.log.entries.forEach(function (entry) {
if (mime && entry.response.content.mimeType !== mime) return;