Skip to content

Instantly share code, notes, and snippets.

View ternavsky's full-sized avatar

Eugene Ternavsky ternavsky

  • https://simplecodesoftware.com/
  • Russia, Novocherkassk
View GitHub Profile
@superbrothers
superbrothers / ansi-color.php
Created August 23, 2012 01:49
ANSI color terminal output module for php
<?php
/**
* php-ansi-color
*
* Original
* https://github.com/loopj/commonjs-ansi-color
*
* @code
* <?php
* require_once "ansi-color.php";
@mobilemind
mobilemind / git-tag-delete-local-and-remote.sh
Last active July 2, 2024 00:02
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
@laracasts
laracasts / ApiTester.php
Created April 9, 2014 23:53
Incremental APIs: Level 9 - Tests (Readable Ones!)
<?php
use Faker\Factory as Faker;
class ApiTester extends TestCase {
/**
* @var Faker
*/
protected $fake;
@tbrianjones
tbrianjones / Inflect.php
Last active February 21, 2024 21:28
A PHP Class for converting English words between Singular and Plural.
<?php
// original source: http://kuwamoto.org/2007/12/17/improved-pluralizing-in-php-actionscript-and-ror/
/*
The MIT License (MIT)
Copyright (c) 2015
Permission is hereby granted, free of charge, to any person obtaining a copy
@asugai
asugai / gist:8408561d5134cf090f78
Last active February 24, 2021 20:10
enable gzip / compression on an Amazon AMI EC2 instance via .htaccess
# Mixings from:
# https://www.clayharmon.com/words/posts/enabling-gzip-compression-on-ec2
# http://www.samaxes.com/2008/04/htaccess-gzip-and-cache-your-site-for-faster-loading-and-bandwidth-saving/
# http://www.tonmoygoswami.com/2013/05/how-to-enable-gzip-on-amazon-elastic.html
# ------------------------------------------------------------------------------
# | Compression |
# ------------------------------------------------------------------------------
<IfModule mod_deflate.c>
@kottenator
kottenator / simple-pagination.js
Created July 13, 2015 20:44
Simple pagination algorithm
// Implementation in ES6
function pagination(c, m) {
var current = c,
last = m,
delta = 2,
left = current - delta,
right = current + delta + 1,
range = [],
rangeWithDots = [],
l;
@zmts
zmts / tokens.md
Last active July 25, 2024 07:03
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Last major update: 25.08.2020

  • Что такое авторизация/аутентификация
  • Где хранить токены
  • Как ставить куки ?
  • Процесс логина
  • Процесс рефреш токенов
  • Кража токенов/Механизм контроля токенов
@asanikovich
asanikovich / Install-xdebug-php7.1.md
Last active May 24, 2018 14:45 — forked from hollodotme/Install-php7.md
Installing xdebug for php7.1 on Ubuntu 14.04

Install xdebug extension

# Download stable release of xdebug from https://xdebug.org/download.php
wget -c "https://xdebug.org/files/xdebug-2.5.3.tgz"
# Extract archive
tar -xf xdebug-2.5.3.tgz

cd xdebug-2.5.3/
@ipedrazas
ipedrazas / dump
Created April 22, 2017 04:10
Mongo dump/restore with docker
# Backup DB
docker run \
--rm \
--link running_mongo:mongo \
-v /data/mongo/backup:/backup \
mongo \
bash -c ‘mongodump --out /backup --host $MONGO_PORT_27017_TCP_ADDR’
# Download the dump
scp -r USER@REMOTE:/data/mongo/backup ./backup
@nbriz
nbriz / scss-v-css.md
Last active June 13, 2024 07:58
SCSS vs modern CSS

CSS vs SASS

CSS on its own can be fun, but stylesheets are getting larger, more complex, and harder to maintain. This is where a preprocessor can help. Sass lets you use features that don't exist in CSS yet like variables, nesting, mixins, inheritance and other nifty goodies that make writing CSS fun again.

that's from the Sass website, while I agree that may have been true 10 years ago, CSS has come a long way since then :) i think most of Sass's features (as listed here) are all things CSS3 has since taken care of. so, without further ado, my case:

Variables

SCSS (example from their website)