Skip to content

Instantly share code, notes, and snippets.

View eriksimonic's full-sized avatar

Erik Simonič eriksimonic

  • Business Solutions d.o.o.
  • Slovenia
View GitHub Profile
@GarthSnyder
GarthSnyder / printer.cfg
Created February 5, 2020 02:47
Klipper configuration for Artillery Sidewinder X1
# Artillery Sidewinder X1 printer.cfg file for Klipper
#
# Garth Snyder - 2/4/2020
#
# NOTE! Nonstandard configuration:
# BLTouch with custom mount (output on XMAX pin)
# Dual Z endstops (second on YMAX pin)
# SKR v1.3 with TMC2208 drivers
# 0.9 degree stepper motors on X and Y
@kevinadi
kevinadi / mongodb-ssl.sh
Last active March 31, 2024 15:07
Script to create self-signed CA certificates, server certificates, and client certificates for testing MongoDB with SSL
#!/bin/sh
# Generate self signed root CA cert
openssl req -nodes -x509 -newkey rsa:2048 -keyout ca.key -out ca.crt -subj "/C=AU/ST=NSW/L=Sydney/O=MongoDB/OU=root/CN=`hostname -f`/emailAddress=kevinadi@mongodb.com"
# Generate server cert to be signed
openssl req -nodes -newkey rsa:2048 -keyout server.key -out server.csr -subj "/C=AU/ST=NSW/L=Sydney/O=MongoDB/OU=server/CN=`hostname -f`/emailAddress=kevinadi@mongodb.com"
# Sign the server cert
@paulirish
paulirish / what-forces-layout.md
Last active June 15, 2024 19:14
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
using System.Linq;
using Examine;
using Umbraco.Core.Persistence;
using Umbraco.Web;
using UmbracoExamine;
namespace Moriyama.PlasterCast.Examine.Indexer
{
public class FasterInternalIndexer : UmbracoContentIndexer
{
@amichaelgrant
amichaelgrant / gist:90d99d7d5d48bf8fd209
Created November 11, 2014 17:41
failed (104: Connection reset by peer) while reading response header from upstream, client:
failed (104: Connection reset by peer) while reading response header from upstream, client:
If you are getting the above error in nginx logs running in from of upstream servers you may consider doing this as it worked for me:
check the ulimit on the machines and ensure it is high enough to handle the load coming in. 'ulimit' on linux, I am told determines the maximum number of open files the kernel can handle.
The way I did that?
modifying limits: for open files:
--------------------------------
add or change this line in /etc/systcl.conf
fs.file-max = <limit-number>
@arlodesign
arlodesign / Pixel Zoom.jsx
Last active November 27, 2021 09:42
100% Pixel-for-Pixel Zoom when designing for web/mobile/tablet in InDesign
// Run this script when using InDesign for web/mobile/tablet comps
// Calculates zoom based on 72ppi, so 100% shows pixel-perfect sizing
app.generalPreferences.customMonitorPpi = 72;
app.generalPreferences.useCustomMonitorResolution = true;
@sitereactor
sitereactor / NodeDto.cs
Created June 9, 2013 08:23
Example of a POCO that is used internally in Umbraco and decorated with various attributes to enable the creation of a table, columns, keys, constraints and indexes using .CreateTable().
using System;
using Umbraco.Core.Persistence;
using Umbraco.Core.Persistence.DatabaseAnnotations;
namespace Umbraco.Core.Models.Rdbms
{
[TableName("umbracoNode")]
[PrimaryKey("id")]
[ExplicitColumns]
internal class NodeDto
@benedfit
benedfit / Footer.cshtml
Last active October 13, 2015 17:38
Dynamically loading Partial View based on media query in Umbraco and access page properties
@mmthomas
mmthomas / ServiceKernel.js
Created November 16, 2012 17:12
A simple JavaScript dependency injection container
/*
*
* A simple JavaScript dependency injection container
* By Monroe Thomas http://blog.coolmuse.com
*
* http://blog.coolmuse.com/2012/11/11/a-simple-javascript-dependency-injection-container/
*
* MIT Licensed.
*
* Unit tests can be found at https://gist.github.com/4270523
<block type="cms/block" name="block_name">
<action method="setBlockId"><id>block_code</id></action>
</block>
{{block type="cms/block" block_id="block_code"}}
{{block type="catalog/product_list" category_id="79" template="catalog/product/list_random.phtml"}}