Skip to content

Instantly share code, notes, and snippets.

View clytras's full-sized avatar

Christos Lytras clytras

View GitHub Profile
@clytras
clytras / php-event-listener-example.php
Created November 21, 2021 02:35 — forked from im4aLL/php-event-listener-example.php
PHP event listener simple example
<?php
// Used in https://github.com/im4aLL/roolith-event
class Event {
private static $events = [];
public static function listen($name, $callback) {
self::$events[$name][] = $callback;
}
@clytras
clytras / PhpArrayToYaml.php
Created February 19, 2021 10:18 — forked from ArnaudLigny/PhpArrayToYaml.php
Convert PHP array to YAML
#!/usr/local/bin/php
<?php
if (php_sapi_name() !== 'cli') {
return;
}
date_default_timezone_set('Europe/Paris');
require_once 'vendor/autoload.php';
use Symfony\Component\Yaml\Yaml;
try {
@clytras
clytras / Commit Formatting.md
Created January 25, 2021 11:57 — forked from brianclements/Commit Formatting.md
Angular Commit Format Reference Sheet

Commit Message Guidelines

We have very precise rules over how our git commit messages can be formatted. This leads to more readable messages that are easy to follow when looking through the project history. But also, we use the git commit messages to generate the Angular change log.

Commit Message Format

Each commit message consists of a header, a body and a footer. The header has a special format that includes a type, a scope and a subject:

@clytras
clytras / popcount.c
Created March 24, 2020 15:43 — forked from kylelk/popcount.c
sqlite extension to calculate population bit count
/* compile osx
* gcc -bundle -fPIC -O3 -o popcount.dylib popcount.c
* */
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <sqlite3ext.h>
SQLITE_EXTENSION_INIT1
@clytras
clytras / index.html
Created December 6, 2019 12:36 — forked from StickyCube/index.html
Electron click through transparency example
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Test App</title>
</head>
<style>
html, body {
height: 100%;
@clytras
clytras / Enhance.js
Created April 4, 2019 14:01 — forked from sebmarkbage/Enhance.js
Higher-order Components
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {
@clytras
clytras / .gitignore
Created March 27, 2019 07:40 — forked from iffy/.gitignore
Example using electron-updater with `generic` provider.
node_modules
dist/
yarn.lock
wwwroot
// PhantomJS Cheatsheet
$ brew update && brew install phantomjs // install PhantomJS with brew
phantom.exit();
var page = require('webpage').create();
page.open('http://example.com', function() {});
page.evaluate(function() { return document.title; });
@clytras
clytras / TransformUtil.js
Created August 23, 2018 15:51 — forked from hpstuff/TransformUtil.js
ReactNativeTransformHelper
import MatrixMath from 'react-native/Libraries/Utilities/MatrixMath';
class TransformUtil {
constructor(matrix) {
this.matrix = matrix || MatrixMath.createIdentityMatrix();
}
perpective(x) {
MatrixMath.reusePerspectiveCommand(this.matrix, x)
@clytras
clytras / watchfiles.md
Created December 1, 2017 21:20 — forked from thiagoh/ watchfiles.md
watchfiles: Watch multiple files and execute bash commands as file changes occur

watchfiles

  • author: Thiago Andrade thiagoh@gmail.com
  • license: GPLv3
  • description:
  • watches the given paths for changes
  • and executes a given command when changes occur
  • usage:
  • watchfiles <paths...>