Skip to content

Instantly share code, notes, and snippets.

Mike Hins mikehins

Block or report user

Report or block mikehins

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View HasManyThrought.php
public function offices()
{
/*
* SQL Query
*
SELECT
`offices`.*,
`office_user`.`user_id` ($1)
FROM
`offices`
@mikehins
mikehins / wp-remove-404
Created Mar 27, 2019
Remove 404 from wordpress for debug purposes
View wp-remove-404
remove_action( 'template_redirect', 'maybe_redirect_404' );
add_filter( 'pre_handle_404', function() {
return false;
});
@mikehins
mikehins / HouseKeeping.php
Last active Jul 15, 2019
Remove unecessary stuff from wordpress
View HouseKeeping.php
<?php
/**
* Created by PhpStorm.
* User: mikeh
* Date: 2018-12-19
* Time: 10:28 AM
*/
class HouseKeeping
{
@mikehins
mikehins / defer iframe video
Last active Jul 2, 2019
function init() { var vidDefer = document.getElementsByTagName('iframe'); for (var i=0; i<vidDefer.length; i++) { if(vidDefer[i].getAttribute('data-src')) { vidDefer[i].setAttribute('src',vidDefer[i].getAttribute('data-src')); } } } window.onload = init;
View defer iframe video
<style>
.resp-container {
position: relative;
overflow: hidden;
padding-top: 56.25%;
}
.resp-iframe {
position: absolute;
top: 0;
left: 0;
@mikehins
mikehins / multi_array_unique.php
Last active Mar 4, 2019
Make a multidimensionnal array unique by key
View multi_array_unique.php
$unique = array_intersect_key($array, array_unique(array_column($array, 'email')));
@mikehins
mikehins / routine.md
Last active May 15, 2019
Forcer les https dans wordpress et opencart
View routine.md

HTACCESS

<ifModule mod_headers.c>
Header set X-XSS-Protection "1; mode=block"
Header always append X-Frame-Options SAMEORIGIN
Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" env=HTTPS
</ifModule>

# Enlever les www (si nécéssaire pour le seo)
@mikehins
mikehins / filter_float.php
Created Dec 7, 2017
Real filter float helper
View filter_float.php
<?php
$data = array(
0 => '1,000.214525844156$', // 1000.21
1 => '1,250.2525698', // 1250.25
2 => '10', // 10.00
3 => 100.21236985, // 100.21
4 => '1,10', // 1.10
5 => '1,000,000,01' // 1000000.01
);
@mikehins
mikehins / Kernel.md
Last active May 16, 2017
Laravel Scheduler Command
View Kernel.md

Je dois migrer / transformer la bd de prod vers celle de staging à chaque soir avec le scheduler.

j'ai un peux plus que 100 000 records à transformer par table, y a une table avec au dessus de 250 000 records en f*** json qui faut que je sépare en plusieurs autres relations

$schedule->command('acme:command1')->timezone('America/Toronto')->dailyAt('20:00')->after(function(){
  $this->call('acme:command2'); 
  $this->call('acme:command3'); 
  $this->call('acme:command4');
View keybase.md

Keybase proof

I hereby claim:

  • I am mikehins on github.
  • I am mikehins (https://keybase.io/mikehins) on keybase.
  • I have a public key ASCW6Wc-gQe9xWBpZGeEprTkF8Lj2ktKVVlWbzrQw-cZogo

To claim this, I am signing this object:

View gist:60d3eab6113e6f61b62cd4c09e6d3f1c
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateTranslationsTable extends Migration
{
/**
* Run the migrations.
You can’t perform that action at this time.