Skip to content

Instantly share code, notes, and snippets.

View ezze's full-sized avatar
💭
Back to the heavyweight jam

Dmitriy Pushkov ezze

💭
Back to the heavyweight jam
View GitHub Profile
@mattmccray
mattmccray / component-with-mixins.js
Created February 17, 2015 19:42
ES6 Classes w/Mixins -- Idea -- React 0.13
export function ComponentWithMixins( ...mixins) {
class MixedComponent extends React.Component { }
for( let mixin of mixins) {
// TODO: Would need to handle mixin collisions...
for( let name of Object.keys( mixin)) {
MixedComponent.prototype[ name]= mixin[ name]
}
}
@mmasashi
mmasashi / .sshrc
Created December 5, 2013 22:45
How to "ssh-add" without entering passphrase.
# ssh-settings
eval $(ssh-agent)
priv_path="$HOME/.ssh/ida_rsa"
passphrase="aaaa"
if [ "$passphrase" = "" ]; then
# without passphrase
ssh-add $priv_path
else
@sanikkenway
sanikkenway / job.rb
Last active February 3, 2019 12:12
if dev.is_bored? || job.sucks?
Job::search(:flexible_hours true, :company_culture 100)
end
@andywer
andywer / router-1.ts
Last active August 6, 2020 14:57
Koa: Passing data from middleware to route handler
/*
* Description:
*
* There are times when we want to re-use some data created/derived in a middleware later in a route handler.
*
* The default Koa way of doing so would be using `context.state`. Unfortunately `context.state` is hard to type and
* quite implicit, since it's an object shared and potentially mutated by all middlewares and the route handler.
*/
/*
@SkaveRat
SkaveRat / gist:9fce0c63458c369a9095
Created July 11, 2015 17:51
Generating matrix.org synapse self signed certificate
# Set your domain here
MXDOMAIN=m.example.com
# This script will ask you for a password. This is for your CA key and you need it in the next step, when signing your application certificate with your CA key. You can remove the "-aes256" flag in the first line to create a passwordless key, but it is not advised in production.
# Let this script run, and move the generated *.tls.* files into your synapse home directory and restart synapse.
# For android to recognize this, you need to copy the "ca.crt.pem" file to your phone and go to: "Settings->Security->import from SD card" and select the pem-file.
# This certificate has a "CA-Flag" set to true, otherwise android would not import this file correctly.
openssl genrsa -aes256 -out ca.key.pem 4096
@electricg
electricg / mouse.js
Last active April 27, 2021 16:32
Mouse position relative to document and element
// Which HTML element is the target of the event
function mouseTarget(e) {
var targ;
if (!e) var e = window.event;
if (e.target) targ = e.target;
else if (e.srcElement) targ = e.srcElement;
if (targ.nodeType == 3) // defeat Safari bug
targ = targ.parentNode;
return targ;
}
@oztune
oztune / install react-devtools v3
Created August 23, 2019 23:26
How to install React Dev Tools v3 so that you can have highlight updates again
1. Somewhere on your machine clone the project.
```
> git clone https://github.com/facebook/react-devtools.git
> cd react-devtools
```
2. Switch to the v3 branch
```
> git checkout v3
```
@stek29
stek29 / proxygram-nginx.conf
Created February 24, 2019 21:52
config for nginx to proxy webogram
server {
server_name gram.com;
location / {
root /var/www/gram;
try_files $uri $uri/index.html;
# protect with basic auth, we don't want to get banned by rkn
auth_basic "webogram";
auth_basic_user_file /var/www/gram.htpasswd;
import React from "react";
import { StyleSheet, Text, View } from "react-native";
import SphericalMercator from "@mapbox/sphericalmercator";
import { MapView, Constants } from "expo";
const merc = new SphericalMercator();
const getZoomLevelFromRegion = (region, viewport) => {
const { longitudeDelta } = region;
const { width } = viewport;
@savely-krasovsky
savely-krasovsky / README.md
Last active February 5, 2023 14:04
Telegram webhooks with nginx reverse proxy

Make config file:

sudo nano /etc/nginx/sites-available/bot.conf

Then copy and paste bot.conf content and edit YOUR.DOMAIN strings. Now install Let's Encrypt on your server. For example in Debian you need to add jessie-backports and easily install it with apt-get:

sudo apt-get install -t jessie-backports letsencrypt

Then get cert for you domain: