Skip to content

Instantly share code, notes, and snippets.

@diegomagikal
diegomagikal / html_share_buttons.html
Last active April 15, 2021 03:08 — forked from Venugopal155/html_share_buttons.html
Pure HTML Share Buttons
<h3>Pure HTML Share Buttons</h3>
<!-- Social Button HTML -->
<!-- Twitter -->
<a href="http://twitter.com/share?url=<URL>&text=<TEXT>&via=<VIA>" target="_blank" class="share-btn twitter">
<i class="fa fa-twitter"></i>
</a>
@diegomagikal
diegomagikal / gist:f3998f2ea97638660d43bceab87c823f
Created November 15, 2020 02:11
Mysql: Uuid to bin / bin to uuid functions
DELIMITER |
CREATE FUNCTION bin_to_uuid(b BINARY(16))
RETURNS CHAR(36) DETERMINISTIC
BEGIN
DECLARE HEX CHAR(32);
SET HEX = HEX(b);
RETURN LOWER(CONCAT(LEFT(HEX, 8), '-', MID(HEX, 9,4), '-', MID(HEX, 13,4), '-', MID(HEX, 17,4), '-', RIGHT(HEX, 12)));
END
|
@diegomagikal
diegomagikal / laravel_post_receive hook
Last active August 30, 2020 03:14 — forked from vool/laravel_post_receive hook
Post receive hook for Laravel website deploy
#!/bin/bash
echo "********************"
echo "Post receive hook: Updating website"
echo "********************"
#set the git repo dir
GIT_REPO_DIR=/var/www/<repo>.git
echo "The git repo dir is $GIT_REPO_DIR"
@diegomagikal
diegomagikal / vscodesync.txt
Created July 24, 2020 13:26
Sync de configurações do VSCODE
/**/
@diegomagikal
diegomagikal / camelToSnake.js
Created May 26, 2019 18:51 — forked from tan-yuki/camelToSnake.js
camel case to snake case
String.prototype.toSnakeCase = function() {
var upperChars = this.match(/([A-Z])/g);
if (! upperChars) {
return this;
}
var str = this.toString();
for (var i = 0, n = upperChars.length; i < n; i++) {
str = str.replace(new RegExp(upperChars[i]), '_' + upperChars[i].toLowerCase());
}
@diegomagikal
diegomagikal / custom-queries.php
Created December 23, 2018 19:24 — forked from carlodaniele/custom-queries.php
An example plugin showing how to add custom query vars, rewrite tags and rewrite rules to WordPress
<?php
/**
* @package Custom_queries
* @version 1.0
*/
/*
Plugin Name: Custom queries
Plugin URI: http://wordpress.org/extend/plugins/#
Description: This is an example plugin
Author: Carlo Daniele
@diegomagikal
diegomagikal / WP_Query.php
Created December 23, 2018 02:51 — forked from Dimasmagadan/WP_Query.php
#WordPress query with args
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php
*/
$args = array(
//////Author Parameters - Show posts associated with certain author.
@diegomagikal
diegomagikal / post-receive
Created November 24, 2018 04:28 — forked from lemiorhan/post-receive
Post-receive hook to deploy the code being pushed to production branch to a specific folder
#!/bin/bash
target_branch="production"
working_tree="PATH_TO_DEPLOY"
while read oldrev newrev refname
do
branch=$(git rev-parse --symbolic --abbrev-ref $refname)
if [ -n "$branch" ] && [ "$target_branch" == "$branch" ]; then
@diegomagikal
diegomagikal / gist:c942aa94e4242a6a984154ccc6081892
Created March 20, 2018 13:06 — forked from gigorok/gist:5ca39384635113495796
php interactive shell with loaded composer dependencies
php -a -d auto_prepend_file=./vendor/autoload.php
@diegomagikal
diegomagikal / post-receive
Created February 20, 2018 11:37 — forked from joshbeitelspacher/post-receive
A Git post-receive hook for deploying files from a branch to a configurable location after every push.
#!/bin/bash
#
# A Git post-receive hook to deploy content from a Git repository on every
# push into a repository. The branches that should be automatically deployed
# must be listed in the config file of the Git repository. The simplest possible
# configuration is shown below:
#
# [deploy "refs/heads/master"]
# directory = /var/www/site
#