Skip to content

Instantly share code, notes, and snippets.

View akaramires's full-sized avatar

Elmar Abdurayimov akaramires

View GitHub Profile
@akaramires
akaramires / laravel laravel-echo laravel-echo-server private channel authentication problems Common Problems faced while setting up private channels with laravel-echo & laravel-echo-server.
I'll start with the basics and proceed to addressing the common problems
faced while setting up private channels with laravel-echo & laravel-echo-server.
If you are getting these errors while setup; 401, 403, 419 etc, as I did in my experience.
this gist will help you fix these errors.
Although this gist addresses common problems of laravel-echo-server setup, some problems are similar with Pusher setup.
So it might also be useful if you're having problems with setting up Pusher with Echo.
I'll try to cover eveything and try to use appropriate highlighting to single out each common problem.
@akaramires
akaramires / .zapier_bash_script.md
Last active September 26, 2019 11:54
Zapier CLI - Staging / Dev / Local

Bash script works with:

  • apps
  • validate
  • push
  • versions
  • logs

Bash script supports:

  • local app
  • dev app
@akaramires
akaramires / mongo-autostart-osx.md
Created July 3, 2017 08:42 — forked from subfuzion/mongo-autostart-osx.md
mongo auto start on OS X

Install with Homebrew

brew install mongodb

Set up launchctl to auto start mongod

$ ln -sfv /usr/local/opt/mongodb/*.plist ~/Library/LaunchAgents

/usr/local/opt/mongodb/ is a symlink to /usr/local/Cellar/mongodb/x.y.z (e.g., 2.4.9)

@akaramires
akaramires / happy_git_on_osx.md
Created March 21, 2017 05:46 — forked from trey/happy_git_on_osx.md
Creating a Happy Git Environment on OS X

Creating a Happy Git Environment on OS X

Step 1: Install Git

brew install git bash-completion

Configure things:

git config --global user.name "Your Name"

git config --global user.email "you@example.com"

@akaramires
akaramires / add_remove_has_class_javascript
Created February 9, 2017 05:13
Add/Remove Classes With Raw Javascript
function hasClass(el, className) {
if (el.classList)
return el.classList.contains(className)
else
return !!el.className.match(new RegExp('(\\s|^)' + className + '(\\s|$)'))
}
function addClass(el, className) {
if (el.classList)
el.classList.add(className)
@akaramires
akaramires / upload_via_iframe
Created January 19, 2017 12:45 — forked from corsonx/upload_via_iframe
Posting a form via AJAX through a hidden iFrame. This is necessary when uploading an image using ajax for IE < 10. It is also useful in other cases, where your post endpoint cannot easily digest JSON, for instance.
// This particular code works with html that looks like this:
<div class="upload_container" id="photo_number_1">
<div><input name="upload" class="photo_upload_field" type="file" /></div>
<div><input type="button" class="upload_photo_submit" value="Upload Photo"></div>
<p class="center loading hidden"><img src="/assets/loading.gif"></p>
<script>
// yes, I know, don't actually put this in a script tag here. It's for illustration purposes only
$('.upload_photo_submit')[0]).click(function(event){ajaxFileUpload(event);});
</script>
@akaramires
akaramires / 00.howto_install_phantomjs.md
Created September 29, 2016 11:36 — forked from julionc/00.howto_install_phantomjs.md
How to install PhantomJS on Debian/Ubuntu

How to install PhantomJS on Ubuntu

Version: 1.9.8

Platform: x86_64

First, install or update to the latest system software.

sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev
Spec
http://es5.github.io Annotated ECMAScript 5.1
Books
JavaScript: The Definitive Guide, David Flanagan
JavaScript: The Good Parts, Douglas Crockford
Secrets of the JavaScript Ninja, John Resig
Pro JavaScript Techniques, John Resig
https://github.com/getify/You-Dont-Know-JS You Don't Know JS
http://bonsaiden.github.io/JavaScript-Garden/ JavaScript Garden
// getCookie(), setCookie(), deleteCookie()
// возвращает cookie если есть или undefined
function getCookie(name) {
var matches = document.cookie.match(new RegExp(
"(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)"
))
return matches ? decodeURIComponent(matches[1]) : undefined
function insertUrlParams(uri, key, value) {
var re = new RegExp("([?|&])" + key + "=.*?(&|$)", "i");
separator = uri.indexOf('?') !== -1 ? "&" : "?";
if (uri.match(re)) {
return uri.replace(re, '$1' + key + "=" + value + '$2');
}
else {
return uri + separator + key + "=" + value;
}
}