Skip to content

Instantly share code, notes, and snippets.

View xaota's full-sized avatar
:octocat:
coding

xaota

:octocat:
coding
View GitHub Profile
@sgmonda
sgmonda / code-print.tex
Last active April 3, 2021 00:29
Simple LaTeX template to print beautiful black&white Javascript source code
\documentclass[a4paper, 12pt]{article}
\usepackage[letterpaper, margin=2cm]{geometry}
\usepackage[T1]{fontenc}
\usepackage{beramono}
\usepackage{listings}
\usepackage{xcolor}
\newcommand\realnumberstyle[1]{}
@TakayoshiKochi
TakayoshiKochi / query-slotted.js
Created August 9, 2017 07:22
Replacement for querySelector("::slotted(x)")
function querySlotted(root, selector) {
let slots = root.querySelectorAll('slot');
let matched = [];
slots.forEach((slot) => {
matched = matched.concat(slot.assignedNodes().filter((el) => {
return el.matches(selector);
}));
});
return matched;
}
@umidjons
umidjons / client-server-post-request-ex-in-pure-node.md
Created August 17, 2016 09:29
Client/Server post request example in pure Node.js

Client/Server POST request example in pure Node.js

File server.js:

var http = require('http');
var querystring = require('querystring');

var server = http.createServer().listen(3000);

server.on('request', function (req, res) {
@dtomasi
dtomasi / default
Last active December 8, 2023 04:20
Brew Nginx PHP7
server {
listen 80;
server_name localhost;
root /Users/YOUR_USERNAME/Sites;
access_log /Library/Logs/default.access.log main;
location / {
include /usr/local/etc/nginx/conf.d/php-fpm;
}
@simoneb
simoneb / rle.js
Created September 13, 2015 23:30
Javascript RLE
var str = 'AAABCCDEEE';
var expected = '3A1B2C1D3E';
var result = _.reduce(str+'\0',(a,c,i,s)=>{if(i&&s[i-1]!== c){a.r+=a.c+s[i-1];a.c=1;}else{a.c++;}return a;},{c:0,r:''}).r
result === expected;

Contributing

When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.

Please note we have a code of conduct, please follow it in all your interactions with the project.

Pull Request Process

  1. Ensure any install or build dependencies are removed before the end of the layer when doing a
@erming
erming / square.html
Last active October 25, 2016 20:25
Responsive square <div> with CSS only
<div class="square">
<div class="square-content">
Hello world!
</div>
</div>
@naholyr
naholyr / _service.md
Created December 13, 2012 09:39
Sample /etc/init.d script

Sample service script for debianoids

Look at LSB init scripts for more information.

Usage

Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
@jessedearing
jessedearing / gist:2351836
Created April 10, 2012 14:44 — forked from twoism-dev/gist:1183437
Create self-signed SSL certificate for Nginx
#!/bin/bash
echo "Generating an SSL private key to sign your certificate..."
openssl genrsa -des3 -out myssl.key 1024
echo "Generating a Certificate Signing Request..."
openssl req -new -key myssl.key -out myssl.csr
echo "Removing passphrase from key (for nginx)..."
cp myssl.key myssl.key.org
openssl rsa -in myssl.key.org -out myssl.key