Skip to content

Instantly share code, notes, and snippets.

View Lawondyss's full-sized avatar

Ladislav Vondráček Lawondyss

  • freelancer
  • Liberec
View GitHub Profile
@dg
dg / git2json.py
Last active October 27, 2021 19:50
Git log to JSON
# install pygit2: pip install pygit2
import pygit2
import json
repo = pygit2.Repository('path/to/repository')
last = repo[repo.head.target]
data = []
for commit in repo.walk(last.id):
@JoeyBurzynski
JoeyBurzynski / 55-bytes-of-css.md
Last active June 2, 2024 11:24
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}
@tomasfejfar
tomasfejfar / .gitconfig
Created May 9, 2016 12:11
Command to create remote stash
[alias]
; creates timestamped branch rst-XXXXX and pushes it to default remote (origin)
rst = "!rst() { export tmpBranch=rst-$(date +%s) && git add -A && git checkout -b $tmpBranch && git commit -m 'WIP remote stash' && git push --set-upstream origin $tmpBranch; }; rst"
@Zeronights
Zeronights / ExtendedReflectionClass.php
Last active April 16, 2024 12:33
PHP: Getting use statements and aliases from class
<?php
/**
* The MIT License (MIT)
*
* Copyright (c) Ozgur (Ozzy) Giritli <ozgur@zeronights.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
@hrach
hrach / nginx.conf
Created June 9, 2014 20:50
nginx + Nette framework rewrite
server {
listen 80;
server_name example.com;
root d:/webs/example.com/www;
index index.php index.html;
try_files $uri $uri/ /index.php?$args;
location ~ \.phpt?$ {
try_files $uri @missing;
@venil
venil / Paral-&-Lax.markdown
Created January 12, 2014 02:28
A Pen by Daniel Riemer.
@dg
dg / websocket.html
Created August 11, 2013 15:54
WebSocket communication between PHP and single client
<!doctype html>
<script>
if ("WebSocket" in window) {
var ws = new WebSocket("ws://127.0.0.1:31339");
ws.onopen = function() {
console.log('connected');
};
ws.onerror = function(e) {
@un1ko85
un1ko85 / new_gist_file.sh
Created May 10, 2013 07:18
Starting and stopping NginX / MySQL / PHP-FPM on Mac OS X
#! /bin/bash
MYSQL="/opt/local/etc/LaunchDaemons/org.macports.mysql5/mysql5.wrapper"
NGINX="/opt/local/sbin/nginx"
PHPFPM="/opt/local/sbin/php-fpm"
PIDPATH="/opt/local/var/run"
MEMCACHED="/opt/local/bin/memcached -m 24 -P /opt/local/var/run/memcached.pid -u root"
if [ $1 = "start" ]; then
sudo $MYSQL start
echo "Starting php-fpm ..."
@cbmd
cbmd / default.conf
Created December 9, 2012 21:13
nginx config - dynamic virtual hosts
server {
index index.php;
set $basepath "/var/www";
set $domain $host;
# check one name domain for simple application
if ($domain ~ "^(.[^.]*)\.dev$") {
set $domain $1;
set $rootpath "${domain}";
@jsifalda
jsifalda / common.conf
Created August 12, 2012 12:21
Nette nginx configuration
# Please paste to folder common/common.conf
index index.html index.htm;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
#location ~ \.(js|ico|gif|jpg|png|css|rar|zip|tar\.gz)$ { }