Skip to content

Instantly share code, notes, and snippets.

View jatubio's full-sized avatar

Juan Antonio Tubio jatubio

View GitHub Profile
@bulbul84
bulbul84 / index.html
Created August 8, 2018 07:19
Bootstrap carousel. Hide 'previous' and 'next' buttons on first and last slide
<div id="myCarousel" class="carousel slide" data-ride="carousel" data-interval="8000">
<!--====/ Slider Pagination /=====-->
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
</ol>
<div class="carousel-inner">
<!--====/ Single Slider /=====-->
-- test by do
-- select extract_json_value('{"a":["a","2"]}','(/a)')
-- common schema
delimiter //
drop function if exists json_to_xml//
create function json_to_xml(
json_text text charset utf8
@jatubio
jatubio / prepare-commit-msg
Last active December 30, 2022 07:36
prepare-commit-msg git hook to add branch name to commit message
#!/bin/sh
#
# An example hook script to prepare the commit log message.
# Called by "git commit" with the name of the file that has the
# commit message, followed by the description of the commit
# message's source. The hook's purpose is to edit the commit
# message file. If the hook fails with a non-zero status,
# the commit is aborted.
#
# To enable this hook, rename this file to "prepare-commit-msg".
# Type(<scope>): <subject>
# <body>
# <footer>
# Type should be one of the following:
# * feat (new feature)
# * fix (bug fix)
# * docs (changes to documentation)
@Erutan409
Erutan409 / MimeType.php
Last active February 15, 2022 18:10
Mime Type Function for PHP
<?php
function mime_type($file) {
// there's a bug that doesn't properly detect
// the mime type of css files
// https://bugs.php.net/bug.php?id=53035
// so the following is used, instead
// src: http://www.freeformatter.com/mime-types-list.html#mime-types-list
@dwightwatson
dwightwatson / TestCase.php
Created September 9, 2014 02:22
Flush and reset Eloquent model events when testing.
<?php
class TestCase extends Illuminate\Foundation\Testing\TestCase {
/**
* Creates the appliation.
*
* @return \Symfony\Component\HttpKernel\HttpKernelInterface
*/
public function createApplication()
@developerdizzle
developerdizzle / IIS Rewrite Cheat Sheet
Last active September 18, 2023 08:22
IIS Rewrite Cheat Sheet
<rewrite>
<!-- Have a bunch of redirects? Put them in a separate file -->
<rules configSource="Rewrites.config" />
<rules>
<!-- Simple rewrite -->
<rule name="Simple rewrite" stopProcessing="true">
<match url="^path/sub path/page\.aspx$" />
<action type="Rewrite" url="/newpath.aspx" />
@isimmons
isimmons / gist:8202227
Last active March 15, 2024 10:47
Truncate tables with foreign key constraints in a Laravel seed file.

For the scenario, imagine posts has a foreign key user_id referencing users.id

public function up()
{
	Schema::create('posts', function(Blueprint $table) {
		$table->increments('id');
		$table->string('title');
		$table->text('body');
@laracasts
laracasts / test.php
Last active July 10, 2018 16:33
Transactions for functional/integration tests.
<?php
class ExampleTest extends TestCase {
public function setUp()
{
parent::setUp();
DB::beginTransaction();
}
@hofmannsven
hofmannsven / README.md
Last active April 19, 2024 13:17
Git CLI Cheatsheet