Skip to content

Instantly share code, notes, and snippets.

View dambrogia's full-sized avatar
🏠
Working from home

Dominic Dambrogia dambrogia

🏠
Working from home
View GitHub Profile
@sveggiani
sveggiani / instructions.md
Last active July 15, 2023 21:52
[Configure XDebug, Visual Studio Code for a Vagrant VM] #debug #vm #vscode #masscode

Configure XDebug, Visual Studio Code for a Vagrant VM

1. Assumptions

  • Project (Drupal) is served on /var/www/html in the Vagrant box
  • Local project files location: c:\Users\username\Work\projects\my-project\repo\html
  • Guest machine IP is 10.0.2.2 (if this doesn't work, run route -nee in the VM and look for the gateway address)

2. Configuration

@ltfschoen
ltfschoen / proportions_of_missing_data_in_dataframe_columns.py
Last active October 20, 2021 07:43
Calculate percentage of NaN values in a Pandas Dataframe for each column. Exclude columns that do not contain any NaN values
# Author: Luke Schoen 2017
import pandas as pd
import numpy as np
import functools
# Create DataFrame
# df = pd.DataFrame(np.random.randn(10,2))
# Populate with NaN values
df = pd.DataFrame({'col1': ['1.111', '2.111', '3.111', '4.111'], 'col2': ['4.111', '5.111', np.NaN, '7.111'], 'col3': ['8', '9', np.NaN, np.NaN], 'col4': ['12', '13', '14', '15']})

How to add an image to a gist

  1. Create a gist if you haven't already.
  2. Clone your gist:
    # make sure to replace `<hash>` with your gist's hash
    git clone https://gist.github.com/<hash>.git # with https
    git clone git@gist.github.com:<hash>.git     # or with ssh
@ukautz
ukautz / s3-in-laravel.php
Last active August 26, 2022 14:44
Using S3 client directly in Laravel
<?php
/** @var \Illuminate\Filesystem\FilesystemAdapter $fs */
$fs = \Storage::disk('object_storage');
/** @var \League\Flysystem\Filesystem $driver */
$driver = $fs->getDriver();
/** @var \League\Flysystem\AwsS3v3\AwsS3Adapter $adapter */
$adapter = $driver->getAdapter();
@fvosberg
fvosberg / install-composer.sh
Created April 19, 2016 20:24
Install composer oneliner for bash with curl
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
@infusion
infusion / import-tar-gz.sh
Last active May 4, 2023 06:00
Import a tar.gz file to MySQL
tar xOf dump.sql.tar.gz | mysql -u $user -p $database
@oswaldoacauan
oswaldoacauan / gist:7580474
Created November 21, 2013 12:06
jQuery - Serialize Form with File inputs
(function($) {
$.fn.serializeFiles = function() {
var form = $(this),
formData = new FormData()
formParams = form.serializeArray();
$.each(form.find('input[type="file"]'), function(i, tag) {
$.each($(tag)[0].files, function(i, file) {
formData.append(tag.name, file);
});