Skip to content

Instantly share code, notes, and snippets.

const amqp = require('amqplib');
class AMQPConsumer {
constructor(connection_uri, queue_name, queue_options) {
this.connection_uri = connection_uri;
this.queue_name = queue_name;
this.queue_options = queue_options;
}
async connect() {
@Reallife
Reallife / default
Created December 22, 2016 21:34 — forked from DarrylDias/default
NGINX configuration for Grav CMS.
server {
listen 80;
server_name localhost; # Change this with your domain name
root /var/www/grav; # The place were you have setup your Grav install;
index index.php;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
@Reallife
Reallife / html.macros.php
Created May 14, 2016 16:05 — forked from ashitvora-zz/html.macros.php
Laravel macro to display flash alert messages
/**
* Display Error / Success / Warn / Info messages
*
* These messages are set using Session::flash(<message_type>, <message>);
*/
HTML::macro("alert", function(){
$alerts = array();
$alert_types = array("error", "success", "warn", "info");
foreach ($alert_types as $type) {
if( Session::has($type) ){
@Reallife
Reallife / gist:3100ebeeb946fb12210fda23937be3ef
Last active May 3, 2016 10:35 — forked from fomigo/gist:2382775
Russian Plural Form in PHP
<?php
/*
echo plural_form(42, array('арбуз', 'арбуза', 'арбузов'));
*/
function plural_form($n, $forms) {
return $n%10==1&&$n%100!=11?$forms[0]:($n%10>=2&&$n%10<=4&&($n%100<10||$n%100>=20)?$forms[1]:$forms[2]);
}
@Reallife
Reallife / BenSmith_Annotations.xml
Last active September 8, 2015 22:28 — forked from RadTechDad/BenSmith_Annotations.xml
BenSmith - PHPStorm Live Templates
<templateSet group="BenSmith-Annotations">
<template name="anno" value="/**&#10;* $ANNOTATIONS$&#10;* @return Response&#10;*/" description="Add docblock ready for annotations below" toReformat="false" toShortenFQNames="true">
<variable name="ANNOTATIONS" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="HTML_TEXT" value="true" />
<option name="HTML" value="true" />
<option name="PHP" value="true" />
</context>
</template>
<template name="@G" value="@Get(&quot;$ROUTE$&quot;, as=&quot;$NAME$&quot;)" description="Get route annotation" toReformat="false" toShortenFQNames="true">

The Laracasts PHPStorm theme - modified.

This is a slightly modified version of the great Laracasts PHPStorm theme. I've added some styles for Verions Control (add, modified, deleted line...) and fixed some missing things like warnings.

Download

image

Mac: Add to ~/Library/Preferences/WebIde80/colors