Skip to content

Instantly share code, notes, and snippets.

@kevindaus
kevindaus / Person.php
Created August 23, 2016 20:32
Person class in public gist
<?php
/**
* Person
*/
class Person extends BadPerson
{
public $firstname;
public $lastname;
public $isGoodPerson;
function __construct($firstname,$lastname,$isGoodPerson = false)
@kevindaus
kevindaus / remap.json
Last active August 23, 2016 20:37
How to remap hjkl in sublime text 2 vintage mode
{ "keys": ["k"], "command": "set_motion", "args": {
"motion": "move",
"motion_args": {"by": "lines", "forward": true, "extend": true },
"linewise": true },
"context": [{"key": "setting.command_mode"}]
},
{ "keys": ["i"], "command": "set_motion", "args": {
"motion": "move",
"motion_args": {"by": "lines", "forward": false, "extend": true },
@kevindaus
kevindaus / GridPageSize.php
Created August 25, 2016 19:11
Yii2 GridPageSize
<?= GridPageSize::widget(['pjaxId'=>'myAwesomeGridViewContainer']) ?>
<?php
Pjax::begin([
'id'=>'myAwesomeGridViewContainer',
])
?>
<?=
GridView::widget([
/*HTTPS for prod*/
if (!defined('YII_DEBUG')) {
if(!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == ""){
$redirect = "https://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
header("HTTP/1.1 301 Moved Permanently");
header("Location: $redirect");
}
}
example inside FOO_VAR.env
located somewhere in your secret folder
PROD_DB_USERNAME = "foobar"
PROD_DB_PASSWORD = "veryveryharduncrackablepassword"
PROD_DB_HOST = "localhost"
PROD_DSN = "mysql:host=localhost;dbname=something_db"
then in your web/index.php
@kevindaus
kevindaus / How to change placeholder of input type date
Created March 14, 2018 18:26
How to change placeholder of input type date
input[type="date"]::before{
color: #999;
content: attr(placeholder);
margin-right: 122px; // push the default placeholder out.. you can add more if you want
}
input[type="date"]:focus::before {
content: "" !important;
display: none;
}
@kevindaus
kevindaus / Wordpress restore subsriber role
Created May 11, 2018 21:22
Wordpress restore subsriber role
add_role( "subscriber", "Subscriber", array(
'read' => 1,
'level_0' => 1,
) );
console.log("%c WARNING!!!", "color:#FF8F1C; font-size:40px;");
console.log("%c This browser feature is for developers only. Please do not copy-paste any code or run any scripts here. ", "color:#003087; font-size:12px;");
console.log("%c For more information, http://en.wikipedia.org/wiki/Self-XSS", "color:#003087; font-size:12px;");
#!/bin/sh
PRODUCT_ID=$1
if [ -z "${PRODUCT_ID}" ]; then
echo "Requires a product ID"
echo
echo "run \"./script.sh <id>\""
fi
@kevindaus
kevindaus / gist:165269a4fcb3233ecbefc6504a05266e
Created March 13, 2020 04:35
How to track function declaration in PHP
<?php
$reflFunc = new ReflectionFunction('THE_FUNCTION_NAME_HERE');
echo $reflFunc->getFileName() . ':' . $reflFunc->getStartLine();
?>