Skip to content

Instantly share code, notes, and snippets.

View fosron's full-sized avatar
💻
Hard at work

Tautvydas fosron

💻
Hard at work
View GitHub Profile
@fosron
fosron / heating.yaml
Last active February 26, 2025 09:26 — forked from r3mcos3/heating.yaml
Home Assistant Blueprint For Heating
blueprint:
name: Heating Control (Basic Switch with Hysteresis & Global Heating Season)
description: >
Control your heating switch based on a lower and an upper temperature threshold,
a time window, and a global heating season condition. When the heating season is off,
the heating will be forced off across all zones.
domain: automation
input:
heating:
name: Heating Switch
@fosron
fosron / filter-wp-request.php
Created February 26, 2025 09:15 — forked from Shelob9/filter-wp-request.php
Using pre_http_request filter to mock HTTP request responses in WordPress phpunit test https://github.com/WordPress/wordpress-develop/blob/trunk/src/wp-includes/class-wp-http.php#L240-L262
<?php
class Test extends TestCase {
public function test_function_that_makes_api_request(){
add_filter('pre_http_request', function(){
return [
'body' => [
'id' => 1,
],
@fosron
fosron / .php_cs.laravel.php
Created April 14, 2020 09:34 — forked from laravel-shift/.php-cs-fixer.php
PHP CS Fixer - Laravel Coding Style Ruleset
<?php
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
$rules = [
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => [
'default' => 'single_space',
'operators' => ['=>' => null]
@fosron
fosron / GPG and git on macOS.md
Created December 10, 2019 14:47 — forked from danieleggert/GPG and git on macOS.md
How to set up git to use the GPG Suite

GPG and git on macOS

Setup

No need for homebrew or anything like that. Works with https://www.git-tower.com and the command line.

  1. Install https://gpgtools.org -- I'd suggest to do a customized install and deselect GPGMail.
  2. Create or import a key -- see below for https://keybase.io
  3. Run gpg --list-secret-keys and look for sec, use the key ID for the next step
  4. Configure git to use GPG -- replace the key with the one from gpg --list-secret-keys
@fosron
fosron / SupervisordInstallationUbuntu12.04LTS.md
Last active February 9, 2018 16:13 — forked from alexhayes/SupervisordInstallationUbuntu12.04LTS.md
Supervisord Installation on Ubuntu 12.04 LTS

Supervisord Installation on Ubutnu 12.04 LTS

There are a number of solutions for installing supervisord and automatically running it on Ubuntu - this is what worked for me (on multiple installations...).

Installation

Quick & Easy

sudo bash &lt; &lt;(curl https://gist.githubusercontent.com/fosron/6a71c4dbb20eed463d764aa4c5799b22/raw/full-install.sh)
@fosron
fosron / SupervisordInstallationUbuntu12.04LTS.md
Created February 9, 2018 16:09 — forked from alexhayes/SupervisordInstallationUbuntu12.04LTS.md
Supervisord Installation on Ubuntu 12.04 LTS

Supervisord Installation on Ubutnu 12.04 LTS

There are a number of solutions for installing supervisord and automatically running it on Ubuntu - this is what worked for me (on multiple installations...).

Installation

Quick & Easy

sudo bash &lt; &lt;(curl https://gist.githubusercontent.com/alexhayes/814fd0d0f7020e918a95/raw/full-install.sh)
@fosron
fosron / CronRunCommand.php
Created December 15, 2016 15:46 — forked from sisou/CronRunCommand.php
Cron job command for Laravel 4.2
<?php
# Cron job command for Laravel 4.2
# Inspired by Laravel 5's new upcoming scheduler (https://laravel-news.com/2014/11/laravel-5-scheduler)
#
# Author: Soren Schwert (GitHub: sisou)
#
# Requirements:
# =============
# PHP 5.4
@fosron
fosron / colors.md
Created September 6, 2016 06:31 — forked from 0x263b/colors.md
Random color from string in javascript

Random color from string in javascript

Consider a list of strings you need to permanently assign a random color.

First you should turn the string into a hash.

var string = "string"
var hash = 0
@fosron
fosron / promises-reading-list.md
Created February 25, 2016 15:48 — forked from joepie91/promises-reading-list.md
Promises (Bluebird) reading list

Promises reading list

This is a list of examples and articles, in roughly the order you should follow them, to show and explain how promises work and why you should use them. I'll probably add more things to this list over time.

This list primarily focuses on Bluebird, but the basic functionality should also work in ES6 Promises, and some examples are included on how to replicate Bluebird functionality with ES6 promises. You should still use Bluebird where possible, though - they are faster, less error-prone, and have more utilities.

I'm available for tutoring and code review :)

You may reuse all gists for any purpose under the WTFPL / CC0 (whichever you prefer).

@fosron
fosron / lumen-resource-route.php
Created February 18, 2016 15:27 — forked from sohelamin/lumen-resource-route.php
Lumen Resource Routing
<?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.