Skip to content

Instantly share code, notes, and snippets.

View yehudamakarov's full-sized avatar
🎯
Focusing

Yehuda Makarov yehudamakarov

🎯
Focusing
View GitHub Profile
@bliuchak
bliuchak / Dockerfile
Last active April 11, 2022 22:36
buf with go plugin (protoc-gen-go)
FROM golang:1.15.7-alpine3.12 as golang
ENV GO111MODULE=on
RUN go get -u google.golang.org/grpc@v1.35.0 \
&& go get -u github.com/golang/protobuf/protoc-gen-go@v1.4.3
FROM bufbuild/buf:0.36.0 as buf
FROM scratch
COPY --from=golang /go/bin/protoc-gen-go /go/bin/protoc-gen-go
COPY --from=buf /usr/local/bin/buf /usr/local/bin/buf
@aheitzmann
aheitzmann / my-connected-component.tsx
Last active September 30, 2021 06:14
A best practice pattern for defining and using typescript types for a redux-react connected component
import * as React from 'react'
import * as Redux from 'redux'
import { MyReduxState } from './my-root-reducer.ts'
export interface OwnProps {
propFromParent: number
}
interface StateProps {
@debovis
debovis / package.json
Last active January 16, 2024 14:13
How to debug gatsby and reactjs with webstorm
{
"name": "project-name",
"version": "1.0.0",
"description": "",
"main": "n/a",
"scripts": {
"serve": "gatsby develop -p 5000",
"dev": "node $NODE_DEBUG_OPTION ./node_modules/.bin/gatsby develop -p 5000",
}
}
@vadymberkut
vadymberkut / ASP NET MVC Using wwwroot static files.txt
Created June 21, 2017 09:24
ASP NET MVC Using wwwroot static files
Create a new ASP.NET 4.5 project in VS2015, selecting the Empty Template
Add OWIN references through nuget (Install-Package Microsoft.Owin.Host.SystemWeb and Microsoft.Owin.StaticFiles)
Add a startup file similar to this:
[assembly: OwinStartup(typeof(MyApp.Startup))]
namespace MyApp.UI
{
public class Startup
{
public void Configuration(IAppBuilder app)
@josephspurrier
josephspurrier / values_pointers.go
Last active July 15, 2024 16:04
Golang - Asterisk and Ampersand Cheatsheet
/*
********************************************************************************
Golang - Asterisk and Ampersand Cheatsheet
********************************************************************************
Also available at: https://play.golang.org/p/lNpnS9j1ma
Allowed:
--------
p := Person{"Steve", 28} stores the value
@denji
denji / nginx-tuning.md
Last active July 23, 2024 23:45
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@codeguy
codeguy / slugify.js
Created September 24, 2013 13:19
Create slug from string in Javascript
function string_to_slug (str) {
str = str.replace(/^\s+|\s+$/g, ''); // trim
str = str.toLowerCase();
// remove accents, swap ñ for n, etc
var from = "àáäâèéëêìíïîòóöôùúüûñç·/_,:;";
var to = "aaaaeeeeiiiioooouuuunc------";
for (var i=0, l=from.length ; i<l ; i++) {
str = str.replace(new RegExp(from.charAt(i), 'g'), to.charAt(i));
}
@jkresner
jkresner / Global.asax
Created October 30, 2012 20:20
Asp .net Mvc 4 Proxy Server/Controller (For help with Cross Domain Request)
public class WebApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
RouteTable.Routes.MapRoute("HttpProxy", "proxy/{*path}", new { controller = "Proxy", action = "Http" })
}
}