Skip to content

Instantly share code, notes, and snippets.

View niladam's full-sized avatar

Madalin Tache niladam

View GitHub Profile
@ehowe
ehowe / sensibo_nest_integration.rb
Created March 19, 2019 19:06
Nest to Sensibo integration
##########
# This is a script I wrote as an AWS lambda function to read sensor data from a Nest and set my Sensibo accordingly
# The API clients are written by me as well and are available at
# https://github.com/ehowe/sensibo-api and https://github.com/ehowe/nest-api
# but can also be installed with `gem install sensibo-api` and `gem install nest-api`.
# The lambda function requires 2 environment variables `API_KEY` for the Sensibo API and `ACCESS_TOKEN` for the Nest API.
# Those API keys will need to be generated in the appropriate developer consoles.
# After creating the Lambda function, you can create a scheduled task in CloudWatch to run the function at whatever interval
# you choose. Mine is set at 15 minutes.
# The function will send all output to CloudWatch as well, which you can act on if you choose.
@calebporzio
calebporzio / webpack.mix.js
Created March 2, 2019 15:17
A webpack.mix.js file for writing NPM packages the way you write JS in a Laravel app.
let mix = require('laravel-mix');
mix.js('src/index.js', 'dist/foo.js').sourceMaps();
mix.webpackConfig({
output: {
libraryTarget: 'umd',
}
})
@mishterk
mishterk / LocalValetDriver.php
Last active August 15, 2024 19:05
A local Valet driver for proxying images to a remote host
<?php
/**
* Class LocalValetDriver
*
* This class demonstrates how we might go about proxying any missing local images to a remote host. i.e; the production
* site. This has been created with WordPress in mind but could be adjusted to work with any other system.
*/
class LocalValetDriver extends WordPressValetDriver {
@calebporzio
calebporzio / chain_helper.php
Last active July 23, 2023 04:27
Handy "chain()" helper method for making non-fluent classes/objects fluent.
<?php
function chain($object)
{
return new class ($object) {
protected $lastReturn = null;
public function __construct($object)
{
$this->wrapped = $object;
<?php
class FieldServiceProvider extends ServiceProvider{
/**
* Bootstrap the field services.
* @return void
*/
public function boot()
{
Nova::serving(function (ServingNova $event) {
$files = app('files');
@bahia0019
bahia0019 / hex-to-rgba.php
Created September 20, 2018 21:23
Convert Hex string to RGBA
<?php
/**
* Take Accent color, and convert it to RGBA, and add an opacity of .75.
*/
$accent = get_theme_mod( 'site_accent_color' );
$accent_string = ltrim( $accent, '#' );
$arr = str_split( $accent_string, '2' );
foreach ( $arr as $value ) {
$new_value = hexdec( $value ) . ', ';
<?php
//Notes: Special Thanks to OleMartinOrg (https://stackoverflow.com/users/2677898/olemartinorg)
//StackOverflow Source: https://stackoverflow.com/questions/5312349/minifying-final-html-output-using-regular-expressions-with-codeigniter.
//Usage: Place code below in new ViewServiceProvider that's registered after the Laravel version:
//$this->app->singleton('blade.compiler', function () {
// return new HtmlMinifyCompiler($this->app['files'], $this->app['config']['view.compiled']);
//});
//$this->app['view']->getEngineResolver()->register('blade', function () {
// return new CompilerEngine($this->app['blade.compiler']);
@devNoiseConsulting
devNoiseConsulting / gist:fb6195fbd09bfb2c1f81367dd9e727ed
Last active December 9, 2020 05:33 — forked from romainneutron/gist:5340930
Download large files using Guzzle 6.3
<?php
require __DIR__ . '/vendor/autoload.php';
use GuzzleHttp\Client;
$url = "https://domain.tld/large-file.mp4";
$tmpFile = tempnam(sys_get_temp_dir(), 'guzzle-download');
$client = new Client(array(
@BlaM
BlaM / cookiebanner-go-away.user.js
Last active September 25, 2025 12:51
Get rid of EU Cookie Banners (Tampermonkey)
// ==UserScript==
// @name Get rid of EU Cookie Banners
// @namespace http://blog.deobald.org/
// @description Get rid of EU Cookie Banners
// @license http://creativecommons.org/licenses/by-nc-sa/3.0/
// @downloadURL https://gist.githubusercontent.com/BlaM/6d826d6e9d77d2d77bf9a92fdad55788/raw/cookiebanner-go-away.user.js
// @homepage https://gist.github.com/BlaM/6d826d6e9d77d2d77bf9a92fdad55788
// @version 0.3.4
// @author Dominik Deobald
// @match http*://*/*
@chargoy
chargoy / gist:664e43ce0a99f9313d73c497376cfb5a
Last active October 17, 2022 21:12
laravel forge nginx with gzip & expires
# FORGE CONFIG (DOT NOT REMOVE!)
include forge-conf/sitio.com/before/*;
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name sitio.com;
root /home/forge/sitio.com/public;
# FORGE SSL (DO NOT REMOVE!)