Skip to content

Instantly share code, notes, and snippets.

View summercms's full-sized avatar
💭
Slow to reply - Busy Coding!

Ayumi summercms

💭
Slow to reply - Busy Coding!
View GitHub Profile
@summercms
summercms / DNS_TO_LOCALHOST.markdown
Created June 29, 2023 21:56 — forked from tinogomes/DNS_TO_LOCALHOST.markdown
Public DNS Pointing to localhost (127.0.0.1)

Available Public Wildcard DNS Domains pointing to localhost (127.0.0.1)

The best way to safely and securely use local domains pointing to 127.0.0.1 is to edit your local settings (/etc/hosts) and add your own settings. Keep in mind if you want to use subdomains, you need to enter all variations.

Example:

# Adding bottom of your current file /etc/hosts
################# MY LOCAL DOMAINS
127.0.0.1 local.com admin.local.com
127.0.0.1 domain1.com
@summercms
summercms / tradingview.js
Created February 14, 2023 11:39 — forked from sudogem/tradingview.js
This script will hide the TradingView logo or any custom logo
// ==UserScript==
// @name New Userscript
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://www.investagrams.com/Chart/PSE:*
// @icon https://www.google.com/s2/favicons?domain=investagrams.com
// @grant none
// ==/UserScript==
@summercms
summercms / array_in_lenght
Created May 22, 2022 18:04 — forked from kirilkirkov/array_in_lenght
Return a size in bytes,kilobytes,megabytes and gigabytes for given array or string. Can be used if you want to check performance for some script.
<?php
function array_size($arr) {
$byte = 0;
foreach ($arr as $key => $val) {
$byte += is_array($val) ? array_size($val) : mb_strlen($val);
}
$kb = number_format($byte / 1024, 4);
$mb = number_format($byte / 1048576, 4);
$gb = number_format($byte / 1073741824, 4);
$result = array('Bytes: ' => $byte, 'Kilobytes: ' => $kb, 'Megabytes: ' => $mb, 'Gigabytes: ' => $gb);
@summercms
summercms / tls_test.php
Created May 22, 2022 17:37 — forked from olivierbellone/tls_test.php
Simple TLS version test for PHP, using howsmyssl.com
<?php
$ch = curl_init('https://www.howsmyssl.com/a/check');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($ch);
curl_close($ch);
$json = json_decode($data);
echo "<pre>TLS version: " . $json->tls_version . "</pre>\n";
@summercms
summercms / ipv6-regex-test.sh
Created February 13, 2022 13:15 — forked from syzdek/ipv6-regex-test.sh
Simple script to test my IPv6 regular expression.
#!/bin/sh
#
# Use posixregex CLI tool from: https://github.com/syzdek/dmstools/blob/master/src/posixregex.c
RE_IPV4="((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])"
posixregex -r "^(${RE_IPV4})$" \
127.0.0.1 \
10.0.0.1 \
192.168.1.1 \
@summercms
summercms / item-listing.js
Created August 23, 2021 14:10 — forked from joseph-montanez/item-listing.js
Php to Javascript Transcoder
<script type="text/javascript">
var js_templates = js_templates || {};
js_templates['item-listing'] = function (data) {
var result_string = [];
result_string.push('<ul>');
var key_502cbbed82967;
for (key_502cbbed82967 in data.items) {
var item = data.items[key_502cbbed82967];
result_string.push('<li class="item');
result_string.push((data.item['sale']) ? ' sale' : '');
@summercms
summercms / indented-checkboxes.md
Created August 5, 2021 06:17 — forked from tekkies/indented-checkboxes.md
Indented markdown checkbox example

Nested checkbox rendering would be nice (view the sourcer for this gist)

  • Task 1
  • Task 2
    • Subtask a
    • Subtask b
  • Task 3

There's no need to complete parents when child nodes are all checked.

@summercms
summercms / Plugin.php
Created July 7, 2021 11:43 — forked from bugzbrown/Plugin.php
Get Plugin System Settings from your templates with a twig extension in OctoberCMS
/*
* In your plugin.php file add the following function
*/
<?php
//...
public function registerMarkupTags()
{
return [
'functions' => [
@summercms
summercms / laravel-removing-stack-traces.md
Created June 11, 2021 19:11 — forked from vades/laravel-removing-stack-traces.md
Removing the error stack traces from logging in Laravel

Removing the error stack traces from logging in Laravel

By default errors in Laravel are logged with the error stack traces. If you want to turn off these annoying stack traces perform the following:

  1. Open
app/Exceptions/Handler.php`
  1. Add
 use Illuminate\Support\Facades\Log;`
@summercms
summercms / confused.md
Created May 31, 2021 17:17 — forked from theseer/confused.md
What happend to the `If-Modified-Since` header?

If-Modified-Since, PHP CLI Server and Firefox

Explanation

When sending the cache control header Cache-Control: no-cache, must-revalidate along with a Last-Modified timestamp, the browser is required to send along an If-Modified-Since header for the next request to the same URL.

The server then is entitled to return HTTP/1.1 304 Not modified in case the content didn't change and the stored copy may still be used.

Sample Code