Skip to content

Instantly share code, notes, and snippets.

View melihovv's full-sized avatar

Alexander Melihov melihovv

  • Russia, Volgograd
View GitHub Profile
@phpdude
phpdude / nginx.conf
Last active February 28, 2024 04:36
Nginx image filter + caching of results.
location /resize {
alias /tmp/nginx/resize;
set $width 150;
set $height 100;
set $dimens "";
if ($uri ~* "^/resize_(\d+)x(\d+)/(.*)" ) {
set $width $1;
set $height $2;
set $image_path $3;
@mcasimir
mcasimir / grammar.pegjs
Created January 17, 2012 18:00
Passing parameters to PEG.js Parser
{
var thisParser = this;
function resolveSymbol(parser, sym){
return (parser.symbols || {})[sym];
}
function flatten(array){
var flat = [];
for (var i = 0, l = array.length; i < l; i++){
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active July 19, 2024 20:54
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@lucasdavila
lucasdavila / 1_ubuntu_terminal_command
Last active February 21, 2024 16:26
Installing Source Code Pro fonts in ubuntu
# to execute this gist, run the line bellow in terminal
\curl -L https://raw.github.com/gist/3875946/install_source_code_pro.sh | sh
@chrisjhoughton
chrisjhoughton / wait-el.js
Last active October 6, 2023 09:46
Wait for an element to exist on the page with jQuery
var waitForEl = function(selector, callback) {
if (jQuery(selector).length) {
callback();
} else {
setTimeout(function() {
waitForEl(selector, callback);
}, 100);
}
};
@carbontwelve
carbontwelve / usefull_commands.sh
Last active June 24, 2021 06:10
Running xdebug in the console, for debugging Laravel artisan commands. Useful as I keep forgetting this one...
# Running xdebug in the console, for debugging Laravel artisan commands. Useful as I keep forgetting this one...
php -dxdebug.remote_autostart artisan
#Running phpcs for 5.3:
phpcs -pv --standards= --runtime-set testVersion 5.3 --ignore=*/public/*,*.js,*.css,*/tests/*,*/views/training/* .
@lttlrck
lttlrck / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@basham
basham / css-units-best-practices.md
Last active July 14, 2024 16:03
CSS Units Best Practices

CSS units

Recommendations of unit types per media type:

Media Recommended Occasional use Infrequent use Not recommended
Screen em, rem, % px ch, ex, vw, vh, vmin, vmax cm, mm, in, pt, pc
Print em, rem, % cm, mm, in, pt, pc ch, ex px, vw, vh, vmin, vmax

Relative units

Relative units

@sogko
sogko / app.js
Last active November 8, 2022 12:31
gulp + expressjs + nodemon + browser-sync
'use strict';
// simple express server
var express = require('express');
var app = express();
var router = express.Router();
app.use(express.static('public'));
app.get('/', function(req, res) {
res.sendfile('./public/index.html');
@colindecarlo
colindecarlo / gist:27e5f7d5261d285df460
Created September 10, 2014 04:43
Jordan Eldredge (@captbaritone) wrote a really helpful post about "Speeding up Laravel tests with database transactions" (http://jordaneldredge.com/blog/speed-up-laravel-tests-with-database-transactions), you should read it. I took what he had done and expanded on it a little, this is my implementation.
As Jordan did, I changed the phpunit bootstrap file from 'bootstrap/autoload.php' to 'bootstrap/testing.php'. My version differs only in that I reference an environment variable `PHPUNIT_SEED_DB`, if that variable is present then I seed the database.
// bootstrap/testing.php
<?php
$shouldSeed = getenv('PHPUNIT_SEED_DB');
if ($shouldSeed) {
passthru("php artisan --env='testing' migrate:refresh");
passthru("php artisan --env='testing' db:seed --class=TestDatabaseSeeder");