Skip to content

Instantly share code, notes, and snippets.

View jaymecd's full-sized avatar

Nikolai Zujev jaymecd

View GitHub Profile
@jaymecd
jaymecd / GitSetup.md
Last active December 25, 2015 02:09
GIT setup

Global git setup

$ curl -sSL https://gist.github.com/jaymecd/6900705/raw/gitconfig | sudo tee /etc/gitconfig

$ curl -sSL https://gist.github.com/jaymecd/6900705/raw/gitignore | sudo tee /etc/gitignore
@jaymecd
jaymecd / BashPrompt.md
Last active April 7, 2021 03:54
PS1 bash prompt with git info

Dynamic bash prompt and alias list

$ curl -sSL https://gist.github.com/jaymecd/6887829/raw/bash_prompt | sudo tee /etc/bash_prompt

$ curl -sSL https://gist.github.com/jaymecd/6887829/raw/bash_alias | sudo tee /etc/bash_alias

$ curl -sSL https://gist.github.com/jaymecd/6887829/raw/bashrc | tee -a ~/.bashrc
@plentz
plentz / nginx.conf
Last active June 25, 2025 06:48
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@benbuckman
benbuckman / logged-bash-script-example.sh
Created July 29, 2013 06:10
tee stdout to log inside bash script
#! /bin/bash
# concept from http://stackoverflow.com/a/3403786/267224
#############
# log to file
LOGFILE=/home/user/log/script.log
exec > >(tee -a $LOGFILE)
exec 2>&1
############
@jacegu
jacegu / gist:6091719
Last active August 3, 2021 03:20
Differences between Domain Services & Application Services

The differences between a domain service and an application services are subtle but critical:

  • Domain services are very granular where as application services are a facade purposed with providing an API.
  • Domain services contain domain logic that can’t naturally be placed in an entity or value object whereas application services orchestrate the execution of domain logic and don’t themselves implement any domain logic.
  • Domain service methods can have other domain elements as operands and return values whereas application services operate upon trivial operands such as identity values and primitive data structures.
  • Application services declare dependencies on infrastructural services required to execute domain logic.
  • Command handlers are a flavor of application services which focus on handling a single command typically in a CQRS architecture.

Source: http://gorodinski.com/blog/2012/04/14/services-in-domain-driven-design-ddd/

@nickleefly
nickleefly / CR_LF.md
Last active December 19, 2015 10:09
Linux command oneline sed oneline, awd oneline, perl oneline The Carriage Return and Line Feed Characters -- How They Affect Text Files On Different Platforms How do I convert between Unix and Windows text files?

Permalink

danielmiessler.com | study | crlf

If you're like I used to be, you always have trouble remembering the difference between how Windows and Linux terminate lines in text files. Does Windows add the extra stuff, or does Linux? What exactly is the extra stuff? How do I get the stuff out?

Well, hopefully by the end of this you'll be taken care of once and for all.

The Characters

<?php
namespace Psr\Log;
interface Loggable
{
public function getContext();
}
class Car implements Loggable
@gnarf
gnarf / ..git-pr.md
Last active June 20, 2025 11:04
git pr - Global .gitconfig aliases for Pull Request Managment

Install

Either copy the aliases from the .gitconfig or run the commands in add-pr-alias.sh

Usage

Easily checkout local copies of pull requests from remotes:

  • git pr 4 - creates local branch pr/4 from the github upstream(if it exists) or origin remote and checks it out
  • git pr 4 someremote - creates local branch pr/4 from someremote remote and checks it out
@felipecsl
felipecsl / restart coreaudio daemon
Last active July 28, 2025 05:11
Restart Mac OS X coreaudio daemon. Useful if you cannot change the audio output device to Airplay.
sudo kill `ps -ax | grep 'coreaudiod' | grep 'sbin' |awk '{print $1}'`
# or...
sudo killall coreaudiod
@dbu
dbu / ImageType.php
Created March 12, 2013 11:03
i needed a form type that determines based on the bound data if it should be required or not (to make file upload required if we create a new entity, but optional when editing the entity with the file. as this happens in a embedded sonata, i have no way of knowing the actual data when creating the form in the form builder. this is what i came up…
<?php
class ImageType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
if ($options['required_auto'] && ! $options['required']) {
$builder->addEventListener(\Symfony\Component\Form\FormEvents::PRE_SET_DATA, array($this, 'determineRequired'));
}