Skip to content

Instantly share code, notes, and snippets.

View j0ssGZ's full-sized avatar
🌳
Programming in nature

Jose Fanjul j0ssGZ

🌳
Programming in nature
View GitHub Profile
@devNoiseConsulting
devNoiseConsulting / gist:fb6195fbd09bfb2c1f81367dd9e727ed
Last active December 9, 2020 05:33 — forked from romainneutron/gist:5340930
Download large files using Guzzle 6.3
<?php
require __DIR__ . '/vendor/autoload.php';
use GuzzleHttp\Client;
$url = "https://domain.tld/large-file.mp4";
$tmpFile = tempnam(sys_get_temp_dir(), 'guzzle-download');
$client = new Client(array(
<?php
function lv2_add_bulma_input_classes( $args, $key, $value = null ) {
// Include in functions.php
/* This is not meant to be here, but it serves as a reference
of what is possible to be changed.
$defaults = array(
'type' => 'text',
'label' => '',
@jacurtis
jacurtis / _spacing-helpers.scss
Last active September 19, 2023 19:09
SASS Margin and Padding Helpers Loop. Generates .m-t-10 type helper classes.
/*
This .scss loop will create "margin helpers" and "padding helpers" for use in your web projects.
It will generate several classes such as:
.m-r-10 which gives margin-right 10 pixels.
.m-r-15 gives MARGIN to the RIGHT 15 pixels.
.m-t-15 gives MARGIN to the TOP 15 pixels and so on.
.p-b-5 gives PADDING to the BOTTOM of 5 pixels
.p-l-40 gives PADDING to the LEFT of 40 pixels
@joashp
joashp / openssl_encrypt_decrypt.php
Created September 4, 2015 15:59
Simple PHP encrypt and decrypt using OpenSSL
<?php
/**
* simple method to encrypt or decrypt a plain text string
* initialization vector(IV) has to be the same when encrypting and decrypting
*
* @param string $action: can be 'encrypt' or 'decrypt'
* @param string $string: string to encrypt or decrypt
*
* @return string
*/
@jrumbut
jrumbut / 500-404-apache-error-report.sh
Last active February 14, 2021 21:55
Get 404 and 500 errors from apache error log
cat access.log.1 | grep " 500 " | awk -F'"' '{print $2,",",$4,",",$6}' > /home/ubuntu/500.log
cat access.log.1 | grep " 404 " | awk -F'"' '{print $2,",",$4,",",$6}' > /home/ubuntu/404.log
@bendc
bendc / nodelist-iteration.js
Created January 13, 2015 14:39
ES6: Iterating over a NodeList
var elements = document.querySelectorAll("div"),
callback = (el) => { console.log(el); };
// Spread operator
[...elements].forEach(callback);
// Array.from()
Array.from(elements).forEach(callback);
// for...of statement
@vladimirtsyupko
vladimirtsyupko / gist:10964772
Created April 17, 2014 08:32
Git force pull to overwrite local files
git fetch --all
git reset --hard origin/master
git pull origin master
@stormwild
stormwild / sql_safe_updates
Last active February 6, 2024 23:52
How to disable MySQL Safe Mode
UPDATE table_name SET bDeleted=0 WHERE name='xyz';
“You are using safe update mode and you tried to update a table without a WHERE clause that uses a KEY column.”
SET SQL_SAFE_UPDATES=0;
UPDATE table_name SET bDeleted=0 WHERE name='xyz';
SET SQL_SAFE_UPDATES=1;
#http://www.xpertdeveloper.com/2011/10/mysql-safe-update/
@CodingNinja
CodingNinja / Manager.php
Created December 30, 2011 13:09
Grant / Revoke ACL Permissions
<?php
/*
* Copyright (C) 2011 David Mann
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
@niran
niran / WordPress category object structure.php
Created July 20, 2009 20:33
WordPress category object structure
<?php
# If you haven't played around with WordPress much and you're trying to find out what
# exactly this "category object" thing that's referenced in many places is. You might
# look for a category table in the database for some clues, but there isn't one. That's
# because WordPress uses "terms" to handle both categories and tags, each of which are
# "taxonomies". Looking in those tables will give you want you want, or you could just
# print a category object.
#
# More info: http://codex.wordpress.org/WordPress_Taxonomy