Skip to content

Instantly share code, notes, and snippets.

View kostasxyz's full-sized avatar

Kostas Charalampidis kostasxyz

View GitHub Profile
@kostasxyz
kostasxyz / sample.md
Created May 17, 2022 11:06 — forked from reanim8ed/sample.md
[Mailhog in Laragon] #email #laragon #laragon
@kostasxyz
kostasxyz / vue-sfc-tpl.vue
Created November 27, 2020 14:36
Vue Single File Component tpl
{
// Place your global snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
// Placeholders with the same ids are connected.
// Example:
"Vue sfc": {
"scope": "javascript,typescript, vue",
@kostasxyz
kostasxyz / timezone-list.json
Created June 5, 2020 13:25
Timezone/Country/offSet list
[{"countryCode":"AD","countryName":"Andorra","zoneName":"Europe\/Andorra","gmtOffset":7200,"timestamp":1591370123},{"countryCode":"AE","countryName":"United Arab Emirates","zoneName":"Asia\/Dubai","gmtOffset":14400,"timestamp":1591377323},{"countryCode":"AF","countryName":"Afghanistan","zoneName":"Asia\/Kabul","gmtOffset":16200,"timestamp":1591379123},{"countryCode":"AG","countryName":"Antigua and Barbuda","zoneName":"America\/Antigua","gmtOffset":-14400,"timestamp":1591348523},{"countryCode":"AI","countryName":"Anguilla","zoneName":"America\/Anguilla","gmtOffset":-14400,"timestamp":1591348523},{"countryCode":"AL","countryName":"Albania","zoneName":"Europe\/Tirane","gmtOffset":7200,"timestamp":1591370123},{"countryCode":"AM","countryName":"Armenia","zoneName":"Asia\/Yerevan","gmtOffset":14400,"timestamp":1591377323},{"countryCode":"AO","countryName":"Angola","zoneName":"Africa\/Luanda","gmtOffset":3600,"timestamp":1591366523},{"countryCode":"AQ","countryName":"Antarctica","zoneName":"Antarctica\/Casey","gmtOf
@kostasxyz
kostasxyz / vue.md
Created May 23, 2020 21:03 — forked from DawidMyslak/vue.md
Vue.js and Vuex - best practices for managing your state

Vue.js and Vuex - best practices for managing your state

Modyfing state object

Example

If you have to extend an existing object with additional property, always prefer Vue.set() over Object.assign() (or spread operator).

Example below explains implications for different implementations.

@kostasxyz
kostasxyz / utils.js
Last active September 13, 2022 12:36
Javascript utility functions
/**
* Build css classnames string.
*
*/
function clx() {
let classes = [];
for (let i = 0; i < arguments.length; i++) {
let arg = arguments[i];
// Load all reaction profiles
function nvlInviteReactionProfiles () {
var pager = document.querySelector('#reaction_profile_pager a');
if(pager !== null) {
pager.click();
pager = null;
setTimeout(() => {
nvlInviteReactionProfiles();
}, 1600);
} else {
@kostasxyz
kostasxyz / critical-css.js
Created July 15, 2017 17:26
Select all elements above the fold and append matched css rules in header
(function () {
document.addEventListener('DOMContentLoaded', function(){
var stylesheets = document.styleSheets;
var wHeight = window.innerHeight;
var criticalCSS = '';
var uniqueRules = [];
var criticalRules = [];
console.log(stylesheets);
@kostasxyz
kostasxyz / gulpStringToFile.js
Created February 18, 2017 12:00 — forked from leocaseiro/gulpStringToFile.js
Create a file within String using Gulp
gulp.task('createFile', function() {
var filename = 'app.js';
var string = "(function() {\n 'use strict';\n angular.module('App', ['ui-route']);\n})();";
return stringToFile(filename, string)
.pipe(gulp.dest('./js'));
});
function stringToFile(filename, string) {
var src = require('stream').Readable({ objectMode: true });
src._read = function () {
@kostasxyz
kostasxyz / SecureSessionHandler.php
Created January 27, 2017 14:47 — forked from eddmann/SecureSessionHandler.php
Secure session handler implementation.
<?php
class SecureSessionHandler extends SessionHandler {
protected $key, $name, $cookie;
public function __construct($key, $name = 'MY_SESSION', $cookie = [])
{
$this->key = $key;
$this->name = $name;
/* ----------------------------------------------------------------------------------------------------
Super Form Reset
A couple of things to watch out for:
- IE8: If a text input doesn't have padding on all sides or none the text won't be centered.
- The default border sizes on text inputs in all UAs seem to be slightly different. You're better off using custom borders.
- You NEED to set the font-size and family on all form elements
- Search inputs need to have their appearance reset and the box-sizing set to content-box to match other UAs