Skip to content

Instantly share code, notes, and snippets.

View thekondrashov's full-sized avatar

Alexandr Kondrashov thekondrashov

View GitHub Profile
@mikelehen
mikelehen / generate-pushid.js
Created February 11, 2015 17:34
JavaScript code for generating Firebase Push IDs
/**
* Fancy ID generator that creates 20-character string identifiers with the following properties:
*
* 1. They're based on timestamp so that they sort *after* any existing ids.
* 2. They contain 72-bits of random data after the timestamp so that IDs won't collide with other clients' IDs.
* 3. They sort *lexicographically* (so the timestamp is converted to characters that will sort properly).
* 4. They're monotonically increasing. Even if you generate more than one in the same timestamp, the
* latter ones will sort after the former ones. We do this by using the previous random bits
* but "incrementing" them by 1 (only in the case of a timestamp collision).
*/
@kuflash
kuflash / git-snippets
Last active July 22, 2017 15:11
GIT Snippets
1. Переключиться на remote ветку:
git fetch
git checkout -b <local-branch-name> <remote-branch-name>
2. Push отдельной папки:
git subtree push --prefix <path/to/folder> <remote-repo> <branch>
3. Поиск коммита по названию:
git log --all --grep=<pattern>
@ericelliott
ericelliott / essential-javascript-links.md
Last active May 17, 2024 03:38
Essential JavaScript Links
@discordier
discordier / gist:ed4b9cba14652e7212f5
Created December 4, 2014 06:23
options for phpStorm @noinspection annotation
javascript
ES6ValidationInspection
JSAccessibilityCheckInspection
JSBitwiseOperatorUsageInspection
JSCheckFunctionSignaturesInspection
JSClosureCompilerSyntaxInspection
JSCommentMatchesSignatureInspection
JSComparisonWithNaNInspection
JSConsecutiveCommasInArrayLiteralInspection
@paskal
paskal / site.conf
Last active May 17, 2024 07:18 — forked from plentz/nginx.conf
Nginx configuration for best security and modest performance. Full info on https://terrty.net/2014/ssl-tls-in-nginx/
# read more at https://terrty.net/2014/ssl-tls-in-nginx/
# latest version on https://gist.github.com/paskal/628882bee1948ef126dd/126e4d1daeb5244aacbbd847c5247c2e293f6adf
# security test score: https://www.ssllabs.com/ssltest/analyze.html?d=terrty.net
# your nginx version might not have all directives included, test this configuration before using in production against your nginx:
# $ nginx -c /etc/nginx/nginx.conf -t
server {
# public key, contains your public key and class 1 certificate, to create:
# (example for startssl)
# $ (cat example.com.pem & wget -O - https://www.startssl.com/certs/class1/sha2/pem/sub.class1.server.sha2.ca.pem) | tee -a /etc/nginx/ssl/domain.pem > /dev/null
@vralle
vralle / README.md
Last active July 30, 2022 10:39
jQuery offcanvas.js (based on Bootstrap Modal.js)

#offcanvas.js

##Usage

The offcanvas plugin toggles your hidden content on demand, via data attributes or JavaScript. It also adds .offcanvas-open to the <body> to override default scrolling behavior and generates a .offcanvas-backdrop to provide a click area for dismissing shown offcanvas when clicking outside the offcanvas.

<!-- Button trigger offcanvas -->
<button class="btn btn-primary" data-toggle="offcanvas" data-target="#myOffcanvas" data-fade="false">
 Launch offcanvas
86937 isset
43159 echo
31697 empty
29252 substr
26146 count
24248 is_array
22572 strlen
19365 sprintf
18090 unset
16584 str_replace
@hdragomir
hdragomir / sm-annotated.html
Last active March 5, 2024 08:57
The deferred font loading logic for Smashing Magazine. http://www.smashingmagazine.com/
<script type="text/javascript">
(function () {
"use strict";
// once cached, the css file is stored on the client forever unless
// the URL below is changed. Any change will invalidate the cache
var css_href = './index_files/web-fonts.css';
// a simple event handler wrapper
function on(el, ev, callback) {
if (el.addEventListener) {
el.addEventListener(ev, callback, false);
@lordspace
lordspace / csv.php
Last active October 6, 2020 20:32 — forked from jaywilliams/csv_to_array.php
a class to read and write CSV
<?php
/**
* This class is used in Orbisius Price Changer for WooCommerce
* This premium WooCommerce extension allows you to change product prices (up/down) for all products or for a selected category and its subcategories.
* You can review them before actually making the changes.
*
* @see http://club.orbisius.com/products/wordpress-plugins/woocommerce-extensions/orbisius-woocommerce-ext-price-changer/
* @author jaywilliams | myd3.com | https://gist.github.com/jaywilliams
* @author Svetoslav Marinov (SLAVI) | http://orbisius.com
@sergejmueller
sergejmueller / ttf2woff2.md
Last active March 9, 2024 13:37
WOFF 2.0 – Learn more about the next generation Web Font Format and convert TTF to WOFF2