Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
Pro

Amir Hassan Azimi hassanazimi

:octocat:
Pro
View GitHub Profile
@hassanazimi
hassanazimi / brew-unlink_relink.sh
Created Apr 26, 2020 — forked from fijimunkii/brew-unlink_relink.sh
brew: unlink and re-link all formulas and kegs
View brew-unlink_relink.sh
@hassanazimi
hassanazimi / regex.md
Created May 13, 2019 — forked from jacurtis/regex.md
Most Useful Regex's
View regex.md

Useful Regular Expressions

These are the most useful Regular Expressions that I find myself using on a regular basis


URLs

Test to see if a string is a valid website address or not.

All URLs
View no-right-click-on-images.js
/*
* This script will look for all images on a page and prevent right clicking on an image.
*/
const images = document.getElementsByTagName('img');
for(var i = 0; i < images.length; i++) {
images[i].addEventListener('contextmenu', event => event.preventDefault());
}
// Note: I threw this script together as requested by a subscriber. I personally don't recommend doing
@hassanazimi
hassanazimi / forge.sh
Created Aug 9, 2018 — forked from radermacher/forge.sh
Laravel Forge Setup Script
View forge.sh
#
# REQUIRES:
# - server (the forge server instance)
# - event (the forge event instance)
# - sudo_password (random password for sudo)
# - db_password (random password for database user)
# - callback (the callback URL)
#
@hassanazimi
hassanazimi / chunk.js
Created Dec 8, 2017 — forked from jperler/chunk.js
Array chunking function for Underscore.js. Usage: _.chunks([1,2,3,4,5,6,7], 2) => [[1,2],[2,3],[4,5],[5,6],[7]]
View chunk.js
_.mixin({
chunks: function(arr, size) {
var len = arr.length,
chunk_len = Math.ceil(len/size),
chunks = [];
for (var i = 0; i < chunk_len; i++) {
chunks.push(arr.slice(i*size, (i+1)*size));
}
return chunks;
}
View vue.js
import Vue from 'vue/dist/vue.esm'
import TurbolinksAdapter from 'vue-turbolinks'
import VueResource from 'vue-resource'
Vue.use(VueResource)
document.addEventListener('turbolinks:load', () => {
Vue.http.headers.common['X-CSRF-Token'] = document.querySelector('meta[name="csrf-token"]').getAttribute('content')
var Profiles = Vue.extend({
@hassanazimi
hassanazimi / _spacing-helpers.scss
Last active Feb 5, 2020 — forked from jacurtis/_spacing-helpers.scss
SASS Margin and Padding Helpers Loop.
View _spacing-helpers.scss
/*
This .scss loop will create "margin helpers" and "padding helpers" for use in your web projects.
It will generate several classes such as:
.mr-10 which gives margin 10 pixels.
.pb-5 gives PADDING 5 pixels
The first letter is "m" or "p" for MARGIN or PADDING
Second letter is "t", "b", "l", or "r" for TOP, BOTTOM, LEFT, or RIGHT
Third letter is the number of spacing in pixels. Adjust the amounts generated by editing the $spaceamounts variable below.
@hassanazimi
hassanazimi / Contract Killer.md
Last active Apr 13, 2017 — forked from malarkey/Contract Killer 3.md
The latest version of my ‘killer contract’ for web designers and developers
View Contract Killer.md

Between [company name]

And [customer name].

Summary:

We’ll always do our best to fulfil your needs and meet your expectations, but it’s important to have things written down so that we both know what’s what, who should do what and when, and what will happen if something goes wrong. In this contract you won’t find any complicated legal terms or long passages of unreadable text. We’ve no desire to trick you into signing something that you might later regret. What we do want is what’s best for both parties, now and in the future.

So in short;

View _Laravel_Queue_Supervisor_Instruction.md

Install Supervisor with sudo apt-get install supervisor in Unix or brew install supervisor in Mac OSX. Ensure it's started with sudo service supervisor restart in Unix or brew services start supervisor in Mac OSX.

In Unix in /etc/supervisord/conf.d/ create a .conf file. In this example, laravel_queue.conf (contents below). Give it execute permissions: chmod +x laravel_queue.conf.

In Mac OSX first run supervisord -c /usr/local/etc/supervisord.ini and in /usr/local/etc/supervisor.d/ create a .conf file. In this example, laravel_queue.conf (contents below). Give it execute permissions: chmod +x laravel_queue.conf.

This file points at /usr/local/bin/run_queue.sh, so create that file there. Give this execute permissions, too: chmod +x run_queue.sh.

Now update Supervisor with: sudo supervisorctl reread in Unix and with: brew services restart supervisor in MAc OSX . And start using those changes with: sudo supervisorctl update.