Skip to content

Instantly share code, notes, and snippets.

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

Fernando PopocaOrtiz

🏠
Working from home
  • Puebla, Mexico
  • 10:25 (UTC -05:00)
View GitHub Profile
@henryonsoftware
henryonsoftware / xdebug_on_ubuntu.md
Last active May 27, 2024 18:25
Install xdebug on Ubuntu

Install Xdebug on Ubuntu.

Install xdebug

Run php -i and copy the output of the following command and paste it on https://xdebug.org/wizard.php. Follow the instructions there to install xDebug.

Example:

  1. Download xdebug-2.6.0.tgz: wget http://xdebug.org/files/xdebug-2.6.0.tgz

  2. Unpack the downloaded file with tar -xvzf xdebug-2.6.0.tgz

@AshikNesin
AshikNesin / react-file-upload.js
Created February 2, 2017 06:46
Simple React File Upload
import React from 'react'
import axios, { post } from 'axios';
class SimpleReactFileUpload extends React.Component {
constructor(props) {
super(props);
this.state ={
file:null
}
@kasparsd
kasparsd / php-excel-xlsx-xml.php
Last active January 18, 2021 14:13
Generate the most basic Excel XLSX and XML files in PHP, see https://kaspars.net/blog/wordpress/excel-xlsx-xml-php
<?php
/**
* UPDATE: This has been converted into a proper PHP library,
* see https://github.com/kasparsd/mini-sheets-php
*/
// Note: there are some references to WordPress methods and functions
class cf7_export_excel {
@bitkidd
bitkidd / deleting_tons_of_files_in_linux.md
Last active August 14, 2018 13:59
Deleting tons of files in Linux (Argument list too long)

If you’re trying to delete a very large number of files at one time (I deleted a directory with 485,000+ today), you will probably run into this error:

/bin/rm: Argument list too long.

The problem is that when you type something like “rm -rf ”, the “” is replaced with a list of every matching file, like “rm -rf file1 file2 file3 file4” and so on. There is a reletively small buffer of memory allocated to storing this list of arguments and if it is filled up, the shell will not execute the program. To get around this problem, a lot of people will use the find command to find every file and pass them one-by-one to the “rm” command like this:

find . -type f -exec rm -v {} \;

My problem is that I needed to delete 500,000 files and it was taking way too long.

@ghinda
ghinda / object-to-form-data.js
Last active May 13, 2025 05:55
JavaScript Object to FormData, with support for nested objects, arrays and File objects. Includes Angular.js usage.
// takes a {} object and returns a FormData object
var objectToFormData = function(obj, form, namespace) {
var fd = form || new FormData();
var formKey;
for(var property in obj) {
if(obj.hasOwnProperty(property)) {
if(namespace) {
@victorbstan
victorbstan / php_object_to_array.php
Created December 17, 2010 04:18
recursively cast a PHP object to array
<?php
/*
This function saved my life.
found on: http://www.sitepoint.com/forums//showthread.php?t=438748
by: crvandyke
It takes an object, and when all else if/else/recursive functions fail to convert the object into an associative array, this one goes for the kill. Who would'a thunk it?!
*/
$array = json_decode(json_encode($object), true);