Skip to content

Instantly share code, notes, and snippets.

@lebalz
lebalz / grid.php
Created February 20, 2020 11:30
creates a grid with dashed lines
<?php
$dt = 40;
$max = 16 * $dt;
?>
<style>
.grid {
position: relative;
border: unset;
width: 100%;
height: <?php echo($max . 'px')?>;
@lebalz
lebalz / mysql_lo_leduc_db.sql
Last active May 14, 2020 14:42
Small db for educational purpose
DROP DATABASE IF EXISTS lo_leduc;
CREATE DATABASE lo_leduc;
USE lo_leduc;
CREATE TABLE alben (
album CHAR(32) PRIMARY KEY,
artist CHAR(32) NOT NULL,
veroeffentlichung DATE
);
@lebalz
lebalz / upload_image.php
Created May 10, 2020 10:25
Upload images with php
<?php
// definiere Funktion "endsWith" falls sie nicht bereits definiert wurde
if (!function_exists('endsWith')) {
/**
* endet $string mit $endString?
* @param string [String]
* @param endString [String]
* @return [boolean]
*/
function endsWith($string, $endString)
@lebalz
lebalz / markdown_table.rb
Created May 11, 2020 08:51
methods to create a markdown-formatted table from 2d-arrays, hashes or csv data
require 'json'
def to_md_row(row, max_field_sizes)
md = row.zip(max_field_sizes).map do |field, sz|
"#{field.to_s.ljust(sz, ' ')}"
end.join(' | ')
"| #{md} |"
end
def table_def_row(max_field_sizes)
SELECT
cols.TABLE_SCHEMA as 'database',
cols.TABLE_NAME as 'table',
cols.COLUMN_NAME as 'column',
cols.DATA_TYPE AS 'data_type',
cols.COLUMN_TYPE AS 'type',
COALESCE(cols.COLUMN_DEFAULT, cols.extra) AS 'default',
(
CASE WHEN COLUMN_KEY='PRI'
THEN 'YES'
@lebalz
lebalz / pip-packages.json
Last active September 1, 2020 14:05
gist example for vs code python2go plugin
[
{
"package": "jupyter"
},
{
"package": "numpy",
"version": "1.19.1"
},
{
"package": "smartphone-connector",
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lebalz
lebalz / 06_functions.ipynb
Last active September 8, 2020 13:27
06_gbsl_functions.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.