Skip to content

Instantly share code, notes, and snippets.

@aquasmit
aquasmit / laravel.js
Created April 24, 2018 02:15 — forked from soufianeEL/laravel.js
You use Laravel 5 and you want to send a DELETE request without creating a form? This will handle the form-creation bits for you dynamically, similar to the Rails implementation. To use, import script, and create a link with the `data-method="DELETE"` and `data-token="{{csrf_token()}}"` attributes.
/*
Exemples :
<a href="posts/2" data-method="delete" data-token="{{csrf_token()}}">
- Or, request confirmation in the process -
<a href="posts/2" data-method="delete" data-token="{{csrf_token()}}" data-confirm="Are you sure?">
*/
(function() {
@aquasmit
aquasmit / gist:5a105610f1c21e1256c51cfecd22fb42
Created December 15, 2017 07:03 — forked from digitaljhelms/gist:4287848
Git/GitHub branching standards & conventions

Branching

Quick Legend

Description, Instructions, Notes
Instance Branch
// Run from the dev tools console of any Youtube video
// Accurate as of October 28, 2016. Uses quality + video type for naming now,
// prevents video urls being overwritten.
// ES6 version
const videoUrls = ytplayer.config.args.url_encoded_fmt_stream_map
.split(',')
.map(item => item
.split('&')
.reduce((prev, curr) => (curr = curr.split('='),
@aquasmit
aquasmit / simple-curl.php
Created November 17, 2016 14:47 — forked from james2doyle/simple-curl.php
a simple PHP curl function to get the content type
function simple_curl($url)
{
$ch = curl_init();
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 20);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_NOBODY, true);
$content = curl_exec ($ch);
@aquasmit
aquasmit / client.js
Created August 11, 2016 05:21 — forked from crtr0/client.js
A simple example of setting-up dynamic "rooms" for socket.io clients to join
// set-up a connection between the client and the server
var socket = io.connect();
// let's assume that the client page, once rendered, knows what room it wants to join
var room = "abc123";
socket.on('connect', function() {
// Connected, let's sign-up for to receive messages for this room
socket.emit('room', room);
});
-- Don't forget to replace »password« with a strong password.
create user 'username'@'localhost' identified by 'password';
grant all privileges on *.* to 'username'@'yourip' IDENTIFIED BY 'password' with grant option;
flush privileges;
@aquasmit
aquasmit / nightmare.sh
Created May 23, 2016 08:14 — forked from dwickstrom/nightmare.sh
NightmareJS - install Electron on Ubuntu 14.04
apt-get -y update
apt-get -y upgrade
apt-get -y --force-yes install make unzip g++ libssl-dev git xvfb x11-xkb-utils xfonts-100dpi xfonts-75dpi xfonts-scalable xfonts-cyrillic x11-apps clang libdbus-1-dev libgtk2.0-dev libnotify-dev libgnome-keyring-dev libgconf2-dev libasound2-dev libcap-dev libcups2-dev libxtst-dev libxss1 libnss3-dev gcc-multilib g++-multilib
npm -f init
npm i -S nightmare
xvfb-run nodejs index.js