Skip to content

Instantly share code, notes, and snippets.

View wajdijurry's full-sized avatar

Wajdi Jurry wajdijurry

View GitHub Profile
@gaearon
gaearon / modern_js.md
Last active April 18, 2024 15:01
Modern JavaScript in React Documentation

If you haven’t worked with JavaScript in the last few years, these three points should give you enough knowledge to feel comfortable reading the React documentation:

  • We define variables with let and const statements. For the purposes of the React documentation, you can consider them equivalent to var.
  • We use the class keyword to define JavaScript classes. There are two things worth remembering about them. Firstly, unlike with objects, you don't need to put commas between class method definitions. Secondly, unlike many other languages with classes, in JavaScript the value of this in a method [depends on how it is called](https://developer.mozilla.org/en-US/docs/Web/Jav
@emilioriosvz
emilioriosvz / rabbitasyncawait.js
Created September 7, 2017 12:04
rabbitmq async await
var amqp = require('amqplib')
var open = require('amqplib').connect('amqp://localhost');
const connect = (url = 'amqp://localhost') => {
return new Promise((resolve, reject) => {
amqp.connect(url)
.then(conn => resolve(conn))
.catch(err => reject(err))
})
@betweenbrain
betweenbrain / life.md
Created February 27, 2016 16:34
Slim 3 Middleware Execution Order Example (last in, first executed)
<?php

require 'vendor/autoload.php';

$app = new \Slim\App();

// Executed last as it's first in (FILE)
$app->add(function ($request, $response, $next) {
	// Execute the routes first
@dalethedeveloper
dalethedeveloper / gist:966848
Created May 11, 2011 16:47
Reorder a PHP array, moving items up or down
<?php
/*
A quick set of functions to move items in a non-associative array
up or down by one, shifting the items around it appropriately.
Original usage was to for a set of UP and DOWN buttons to
manipulate the order of an array of items stored in Wordpress option.
*/
$a = array('a','b','c','d','e');