Skip to content

Instantly share code, notes, and snippets.

View kpion's full-sized avatar

Konrad Papała kpion

View GitHub Profile
@kpion
kpion / swap-thing.md
Last active January 28, 2019 01:54
swap-thing

swap thing

result of using gui KDE Partition manager:

Job: Create file system ‘linuxswap’ on partition ‘/dev/sda2’ 
Command: mkswap /dev/sda2 
Setting up swapspace version 1, size = 4 GiB (4294963200 bytes)
no label, UUID=90a5be52-fca4-48ed-9bc0-18578ee6fb2f 
Create file system ‘linuxswap’ on partition ‘/dev/sda2’: Success
Just in case it gets deleted :)
https://blogs.msdn.microsoft.com/scottdensmore/2004/05/25/why-singletons-are-evil/
http://steve.yegge.googlepages.com/singleton-considered-stupid
http://googletesting.blogspot.com/2008/11/clean-code-talks-global-state-and.html
https://www.alainschlesser.com/singletons-shared-instances/
http://misko.hevery.com/2008/08/17/singletons-are-pathological-liars/

Javascript new Error().stack; output examples

<script>
  let stack = new Error().stack;
  console.log(stack);
</script>

All browsers return a string delimited by a \n.

<?php
/*
Question about architecture.
This is supposed to be a simple Wordpress rest api client.
The example of one of the endpoints (users) is here: https://developer.wordpress.org/rest-api/reference/users/#example-request
to list users: GET http://demo.wp-api.org/wp-json/wp/v2/users
to create a user: POST http://demo.wp-api.org/wp-json/wp/v2/users with some required arguments
@kpion
kpion / remove-tab-bar-firefox
Created November 16, 2017 15:05
How to remove tab bar in Firefox
# when you installed the Tree Style Tab in your Firefox Quantum or any newer,
# you don't need the FX's Tab Bar anymore, therefore:
1. Click help -> Troubleshooting Information -> next to "Profile Directory " click "Open Directory".
(if you can't see the menu, click the "wrench" icon on the right, then Help and Troubleshooting Information )
2. Create (if not exists) a "chrome" directory
3. Create (if not exists) "userChrome.css" file and edit it
public function defaultMethod() {
lib::$view->assign("pageTemplate", $this->templateDir."cities.tpl");
$cityId = 2;
$defaultCityIds = '2, 3, 7, 12';
$cityIds = null;
if (isset($_GET['city']) && !empty($_GET['city'])) {
$cityId = $_GET['city'];
$cityIds = $_GET['city'];
}else{
df -h /dev/sdc1
Filesystem Size Used Avail Use% Mounted on
/dev/sdc1 699G 692G 6,8G 100% /media/konrad/Elements
bind ^S savefile main
bind ^F whereis main
bind F3 findnext main
#bind esc cancel main
bind ^X cut main
bind ^C copytext main
bind ^V uncut main
How to get PHP errors to log/display
TL;DR:
Put/modify this in the php.ini file:
error_reporting = -1
display_errors = On
Long version:
@kpion
kpion / test
Created February 22, 2017 04:12
adfadfadsf