Skip to content

Instantly share code, notes, and snippets.

@premek
premek / mv.sh
Last active March 5, 2024 17:43
Rename files in linux / bash using mv command without typing the full name two times
# Put this function to your .bashrc file.
# Usage: mv oldfilename
# If you call mv without the second parameter it will prompt you to edit the filename on command line.
# Original mv is called when it's called with more than one argument.
# It's useful when you want to change just a few letters in a long name.
#
# Also see:
# - imv from renameutils
# - Ctrl-W Ctrl-Y Ctrl-Y (cut last word, paste, paste)
@u01jmg3
u01jmg3 / .gitconfig
Last active August 19, 2019 17:07
Sourcetree Custom Actions
[alias]
cordova = "!f(){ MESSAGE=\"Build assets for deployment\"; [ \"$(git log -1 HEAD --pretty=format:%s)\" != \"$MESSAGE\" ] && git allclean && cordova prepare --release && git add -A && git commit -m \"$MESSAGE\" && git push || echo \"Commit already present\"; }; f"
fetch-pr = "!f(){ git fetch origin refs/pull/$1/head:pr/$1; }; f"
cleanup = !git clean -df
quick-clean = !git checkout . & git cleanup
all-clean = !git reset --hard && git cleanup
swap-last = !git tag _invert && git reset --hard HEAD~2 && git cherry-pick _invert _invert~1 && git tag -d _invert
invert-index = !git commit -m tmp1 && git add -A && git commit -m tmp2 && git swap-last && git reset HEAD~1 && git reset HEAD~1 --soft
@JJediny
JJediny / Jenkinsfile
Created February 22, 2017 20:17 — forked from abayer/Jenkinsfile
An example Declarative Pipeline Jenkinsfile for Feb 15 2017 demo
// A Declarative Pipeline is defined within a 'pipeline' block.
pipeline {
// agent defines where the pipeline will run.
agent {
// This also could have been 'agent any' - that has the same meaning.
label ""
// Other possible built-in agent types are 'agent none', for not running the
// top-level on any agent (which results in you needing to specify agents on
// each stage and do explicit checkouts of scm in those stages), 'docker',
@michaelneu
michaelneu / Dockerfile
Last active October 17, 2022 05:37
docker-compose configuration for PHP with NGINX and MySQL, including sendmail, MailDev and phpmyadmin
# see https://github.com/cmaessen/docker-php-sendmail for more information
FROM php:5-fpm
RUN apt-get update && apt-get install -q -y ssmtp mailutils && rm -rf /var/lib/apt/lists/*
RUN docker-php-ext-install mysql mysqli sysvsem
RUN pecl install xdebug-2.5.5 \
&& echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini \
@archy-bold
archy-bold / ExamplePassportTest.php
Last active October 15, 2022 03:49
Testing Passport Authenticated Controllers and Routes in Laravel
<?php
use Illuminate\Foundation\Testing\WithoutMiddleware;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;
class ExamplePassportTest extends \PassportTestCase
{
use DatabaseTransactions;
@fatso83
fatso83 / srcset-debug-util.js
Last active October 30, 2023 10:53
SrcSet debug utility to print info on the currently loaded image
/**
* Use this to help determine which images are being used
* at which breakpoint. Will print lots of useful information
* on shown resolution, actual resolution, DPR and more
* Usage:
* var elems = document.querySelectorAll('.c-hero-banner__background img')
* responsiveImageDebugOutput(elems);
*
* Author: Carl-Erik Kopseng
* Source: https://gist.github.com/fatso83/55fc446df3f3965ecd66e8307a5dc0e6

This document has moved!

It's now here, in The Programmer's Compendium. The content is the same as before, but being part of the compendium means that it's actively maintained.

@stuarthendren
stuarthendren / .gitalias
Last active August 11, 2020 18:47
.gitalias
[alias]
# List alias commands
la = "!git config -l | grep alias | cut -c 7-"
list-alias = "!git la"
# List commits in increasing detail
l = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short
ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat
lll = log -u
# Most common diffs
diffc = diff --cached HEAD^
@ralphschindler
ralphschindler / README.md
Last active May 1, 2024 19:14
Docker For Mac Host Address Alias To Enable PHP XDebug (10.254.254.254 Trick)

Docker (Mac) De-facto Standard Host Address Alias

This launchd script will ensure that your Docker environment on your Mac will have 10.254.254.254 as an alias on your loopback device (127.0.0.1). The command being run is ifconfig lo0 alias 10.254.254.254.

Once your machine has a well known IP address, your PHP container will then be able to connect to it, specifically XDebug can connect to it at the configured xdebug.remote_host.

Installation Of IP Alias (This survives reboot)

Copy/Paste the following in terminal with sudo (must be root as the target directory is owned by root)...

@santoshachari
santoshachari / Laravel PHP7 LEMP AWS.md
Last active February 20, 2024 10:00
Laravel 5.x on Ubuntu 16.x, PHP 7.x, Nginx 1.9.x

#Steps to install latest Laravel, LEMP on AWS Ubuntu 16.4 version. This tutorial is the improvised verision of this tutorial on Digitalocean based on my experience.

Install PHP 7 on Ubuntu

Run the following commands in sequence.

sudo apt-get install -y language-pack-en-base
sudo LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install zip unzip