Skip to content

Instantly share code, notes, and snippets.

Avatar

Luismi Sánchez luismisanchez

View GitHub Profile
@luismisanchez
luismisanchez / Modules.ts
Created Jan 19, 2021
Typescript Modules
View Modules.ts
// TypeScript is modular, we can divide our code up over several files
// In Angular 2 we then use "import {} from ''" to access the code in these files
// We export a class, interface, variable, ... by adding 'export' keyword in front of it
export class ExportedClass {
// This class is exported
}
@luismisanchez
luismisanchez / Generics.ts
Created Jan 19, 2021
Typescript Generics
View Generics.ts
// Generics are types which can hold/ use several types
// We're only touching the very basics here - you can go MUCH more into detail
// Consider the Array object
let numberArray: Array<number>; // This array will only accept numbers
// Try to initialize it with strings
// numberArray = ['test']; // => Error
@luismisanchez
luismisanchez / Interfaces.ts
Created Jan 19, 2021
Typescript Interfaces
View Interfaces.ts
// Interfaces allow us to create contracts other classes/ objects have to implement
// We can use them to define custom types without creating classes
// Interfaces ARE NOT compiled to JavaScript! It's just for checking/ validation done by our TypeScript compiler
// Example interface
interface User {
username: string;
password: string;
confirmPassword?: string; // Optional property => Does not have to be implemented
@luismisanchez
luismisanchez / Classes.ts
Created Jan 15, 2021
Typescript Classes
View Classes.ts
// Classes allow us to create 'blueprints' for objects
// In Angular 2 we use classes a lot. For example to create Components, Services, Directives, Pipes, ...
// How to create a class
class Car {
engineName: string;
gears: number;
private speed: number;
@luismisanchez
luismisanchez / typing.ts
Last active Jan 15, 2021
Typescript Typing
View typing.ts
// TypeScripts - well - strong typing allows us to define types for our variables and class members
// The compiler is going to yell at us if we assign a value of a wrong type to such a variable or member
// Declaring a variable with a type
// Using the 'let' keyword to create a variable ('const' would define an immutable constant)
let myString: string;
myString = 'This is a string';
@luismisanchez
luismisanchez / my.cnf
Created Jun 25, 2020 — forked from fevangelou/my.cnf
Optimized my.cnf configuration for MySQL/MariaSQL (on Ubuntu, CentOS etc. servers)
View my.cnf
# Optimized my.cnf configuration for MySQL/MariaSQL
#
# by Fotis Evangelou, developer of Engintron (engintron.com)
#
# ~ Updated January 2020 ~
#
#
# The settings provided below are a starting point for a 2GB - 4GB RAM server with 2-4 CPU cores.
# If you have different resources available you should adjust accordingly to save CPU, RAM & disk I/O usage.
#
@luismisanchez
luismisanchez / index.html
Created Jul 10, 2019
Responsive Tables (By columns)
View index.html
<h2>Column oriented table</h2>
<div class="Rtable Rtable--3cols">
<div style="order:1;" class="Rtable-cell"><h3>Eddard Stark</h3></div>
<div style="order:2;" class="Rtable-cell">Has a sword named Ice</div>
<div style="order:3;" class="Rtable-cell">No direwolf</div>
<div style="order:4;" class="Rtable-cell"><strong>Lord of Winterfell</strong></div>
<div style="order:1;" class="Rtable-cell"><h3>Jon Snow</h3></div>
View install_wordpress.php
<?php
header('Content-type: text/plain; charset=utf-8');
error_reporting(E_ALL);
ini_set('display_errors', 1);
$script = basename(__FILE__);
$link = $_SERVER['HTTP_HOST'];
// Si venimos desde el botón INSTALAR WORDPRESS
// borramos este archivo y redirigimos al script de instalación de WordPress