Skip to content

Instantly share code, notes, and snippets.

@stef-k
stef-k / info.md
Last active October 8, 2023 21:15
MAUI BLAZOR HYBRID USEFUL INFO

Version .net core 7

Display prompts and alerts

var result = await Application.Current.MainPage.DisplayAlert("Title", "Prompt", "Yes", "No");
await Application.Current.MainPage.DisplayAlert("Title", "Message", "OK");
@stef-k
stef-k / Contributing.md
Created September 9, 2023 15:39 — forked from MarcDiethelm/Contributing.md
How to contribute to a project on Github

This text now lives at https://github.com/MarcDiethelm/contributing/blob/master/README.md. I turned it into a Github repo so you can, you know, contribute to it by making pull requests.


Contributing

If you want to contribute to a project and make it better, your help is very welcome. Contributing is also a great way to learn more about social coding on Github, new technologies and and their ecosystems and how to make constructive, helpful bug reports, feature requests and the noblest of all contributions: a good, clean pull request.

# Removes all files and folders in user's Desktop except shortcuts
# Warning !!!
# Remove the -WhatIf to actually delete the file and directory objects !!!
#
Remove-Item "$home\Desktop\*" -Recurse -Exclude "*.lnk" -WhatIf
Remove-Item "$home\Desktop\*.*" -Recurse -Exclude "*.lnk" -WhatIf
@stef-k
stef-k / AES.cs
Created December 10, 2020 16:44 — forked from mhingston/AES.cs
AES-256-CBC for C# and Node
using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
class AES
{
public static string Encrypt(string plainText, string keyString)
{
byte[] cipherData;
@stef-k
stef-k / encryption.js
Created May 2, 2020 19:30 — forked from vlucas/encryption.ts
Stronger Encryption and Decryption in Node.js
'use strict';
const crypto = require('crypto');
const ENCRYPTION_KEY = process.env.ENCRYPTION_KEY; // Must be 256 bits (32 characters)
const IV_LENGTH = 16; // For AES, this is always 16
function encrypt(text) {
let iv = crypto.randomBytes(IV_LENGTH);
let cipher = crypto.createCipheriv('aes-256-cbc', Buffer.from(ENCRYPTION_KEY), iv);
<?php
/*
* PHP CS Fixer configuration
*/
return PhpCsFixer\Config::create()
->setRules([
'@PSR2' => true,
'@PHP70Migration' => true,
'@PhpCsFixer' => true,
@stef-k
stef-k / google-alanytics-track-outbound.js
Last active October 3, 2018 04:45
Google analytics track outbound links
// Original source and author: https://www.axllent.org/docs/view/track-outbound-links-with-analytics-js/
function _gaLt(event) {
try {
/* If GA is blocked or not loaded, or not main|middle|touch click then don't track */
if (!ga.hasOwnProperty("loaded") || ga.loaded != true || (event.which != 1 && event.which != 2)) {
return;
}
var el = event.srcElement || event.target;
@stef-k
stef-k / xdebug.md
Last active July 8, 2017 12:51 — forked from ankurk91/xdebug-mac.md
php xDebug on Ubuntu and phpStorm 2016

🪲 Install and Configure xDebug on Ubuntu and Php Storm 🐘

  • Assuming that you have already installed php and apache
  • Install xDebug php extension
# Ubuntu 16.04, php 7.0
sudo apt-get install php-xdebug

# Ubuntu 14.04, php 5.6 
sudo apt-get install php5-xdebug
@stef-k
stef-k / sshd_config
Created June 11, 2017 09:44
SSH config tweaks
# Package generated configuration file
# See the sshd_config(5) manpage for details
# What ports, IPs and protocols we listen for
Port 22
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress 0.0.0.0
Protocol 2
# HostKeys for protocol version 2
@stef-k
stef-k / php.ini
Created June 11, 2017 09:21
php fpm ini tweaks
[PHP]
;;;;;;;;;;;;;;;;;;;
; About php.ini ;
;;;;;;;;;;;;;;;;;;;
; PHP's initialization file, generally called php.ini, is responsible for
; configuring many of the aspects of PHP's behavior.
; PHP attempts to find and load this configuration from a number of locations.
; The following is a summary of its search order: