Skip to content

Instantly share code, notes, and snippets.

@kongondo
kongondo / letsencrypt-webroot-apache.md
Created November 9, 2020 07:58 — forked from daronco/letsencrypt-webroot-apache.md
Letsencrypt with webroot on Apache

Config Apache with /etc/apache2/conf-available/le.conf:

Alias /.well-known/acme-challenge/ "/var/www/html/.well-known/acme-challenge/"
<Directory "/var/www/html/">
    AllowOverride None
    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
    Require method GET POST OPTIONS
</Directory>
@kongondo
kongondo / .gitignore
Created October 18, 2020 09:38 — forked from hieblmedia/.gitignore
Gitignore - Exclude all except specific subdirectory
#
# If all files excluded and you will include only specific sub-directories
# the parent path must matched before.
#
/**
!/.gitignore
###############################
# Un-ignore the affected subdirectory
/**
* Validates hex value
* @param {String} color hex color value
* @return {Boolean}
*/
function isValidHex(color) {
if(!color || typeof color !== 'string') return false;
// Validate hex values
if(color.substring(0, 1) === '#') color = color.substring(1);
@kongondo
kongondo / CKEditor.vue
Created May 28, 2020 04:14 — forked from pi0/CKEditor.vue
CKEditor
<!-- Based on https://github.com/dangvanthanh/vue-ckeditor -->
<template>
<div class="ckeditor">
<textarea :id="id" :value="value"></textarea>
</div>
</template>
<style scoped>
.ckeditor {
@kongondo
kongondo / currency_list
Created January 13, 2020 12:05 — forked from champsupertramp/currency_list
World Currency list in PHP Array
array (
'ALL' => 'Albania Lek',
'AFN' => 'Afghanistan Afghani',
'ARS' => 'Argentina Peso',
'AWG' => 'Aruba Guilder',
'AUD' => 'Australia Dollar',
'AZN' => 'Azerbaijan New Manat',
'BSD' => 'Bahamas Dollar',
'BBD' => 'Barbados Dollar',
'BDT' => 'Bangladeshi taka',
@kongondo
kongondo / menu-builder-getmenuitems-show-more.php
Last active December 17, 2019 12:31
Example Menu Builder 'Show More' Recursive Menu
<?php
/**
* Builds a nested list (menu items) of a single menu.
*
* A recursive function to display nested list of menu items.
*
* @param integer $parent ID of menu item to start build.
* @param WireArray $menu WireArray Object of menu items to display.
* @param integer $first Helper variable to designate first menu item and <ul></ul>.
@kongondo
kongondo / parsce-csv-test.js
Created November 15, 2019 11:12 — forked from atomkirk/parsce-csv-test.js
parse csv with javascript
import parseCsv from 'zipbooks/utils/parse-csv'
import { module, test } from 'qunit'
module('Unit | Utility | parse-csv', function(_hooks) {
test('parses csv successfully', function(assert) {
let result = parseCsv('name,age\nadam,31\ntim,32\n"St, clair",26')
assert.equal(JSON.stringify(result), '[["name","age"],["adam","31"],["tim","32"],["St, clair","26"]]')
})
@kongondo
kongondo / vue.json
Created September 26, 2019 12:03 — forked from rochabianca/vue.json
Snippet to bring back scaffold on vue on vscode. To use it go to Code>Preferences>User Snippets type vue on the input and paste this code there.
{
"bring back the scaffold to vue files": {
"prefix": "scaffold",
"body": [
"<template>",
" <div>$TM_FILENAME_BASE</div>",
"</template>",
"",
"<script>",
"export default {",
@kongondo
kongondo / restrict-same-user-session.php
Last active October 1, 2018 12:53
ProcessWire: Restrict logins for users so that one user cannot be loggedin in more than once simultaneously
<?php namespace ProcessWire;
// code goes in ready.php
// Hook into login/logout sessions
wire()->addHookAfter('Session::loginSuccess', null, 'checkLoggedIn');
wire()->addHookBefore('Session::logout', null, 'removeLoggedIn');// Hook before to get $user->id
/**
* Check if a user is already logged in
*
* If user logged in, take an action (notify,logout,etc).