Skip to content

Instantly share code, notes, and snippets.

View muhamed-didovic's full-sized avatar
😎

Muhamed muhamed-didovic

😎
View GitHub Profile
@muhamed-didovic
muhamed-didovic / machine.js
Last active July 24, 2023 22:47
Generated by XState Viz: https://xstate.js.org/viz
const loadFromDatabase = async () => {
// Your database loading logic goes here
// For example, you can use an API call to fetch the data from your backend
// Make sure to return the fetched data or handle errors accordingly
return 'from1';
return await yourDatabaseAPI.loadFormData();
};
const saveToDatabase = async (formData) => {
kopiraj(){
rsync -avh \
--exclude='markup/node_modules/' \
--exclude='wp/public/wp-content/themes/*/node_modules/' \
--exclude='wordpress/public/wp-content/themes/*/node_modules/' \
--exclude='wp/public/wp-content/uploads/assets/' \
--exclude='.env' \
--exclude='.idea/' \
--exclude='wp/vendor/' \
--exclude='wordpress/vendor/' \
@muhamed-didovic
muhamed-didovic / resume.json
Last active December 23, 2020 23:40
my resume
{
"$schema": "https://raw.githubusercontent.com/jsonresume/resume-schema/v1.0.0/schema.json",
"meta": {
"theme": "elegant"
},
"basics": {
"name": "Muhamed Didović",
"label": "Full Stack Web Developer",
"image": "https://avatars1.githubusercontent.com/u/3872717?s=460&u=0347279297c79c031fbd4327965455be8f7e8fb5&v=4",
"picture": "https://avatars1.githubusercontent.com/u/3872717?s=460&u=0347279297c79c031fbd4327965455be8f7e8fb5&v=4",
@muhamed-didovic
muhamed-didovic / error_blade_directive.php
Created March 29, 2019 12:48 — forked from calebporzio/error_blade_directive.php
A little Blade directive to make working with validation errors a bit nicer.
<?php
// Usage:
// Before
@if ($errors->has('email'))
<span>{{ $errors->first('email') }}</span>
@endif
// After:
@muhamed-didovic
muhamed-didovic / learning_resources.md
Created March 24, 2018 09:26 — forked from nathansmith/web-design-development-learning-resources.md
Resources for learning web design & front-end development
@muhamed-didovic
muhamed-didovic / timestamp.js
Created May 13, 2016 13:40 — forked from hurjas/timestamp.js
Print out a nicely formatted timestamp in JavaScript.
/**
* Return a timestamp with the format "m/d/yy h:MM:ss TT"
* @type {Date}
*/
function timeStamp() {
// Create a date object with the current time
var now = new Date();
// Create an array with the current month, day and time
@muhamed-didovic
muhamed-didovic / longPolling.js
Created February 25, 2016 23:33 — forked from jasdeepkhalsa/longPolling.js
Simple Long Polling Example with JavaScript and jQuery by Tian Davis (@tiandavis) from Techoctave.com (http://techoctave.com/c7/posts/60-simple-long-polling-example-with-javascript-and-jquery)
// Long Polling (Recommened Technique - Creates An Open Connection To Server ∴ Fast)
(function poll(){
$.ajax({ url: "server", success: function(data){
//Update your dashboard gauge
salesGauge.setValue(data.value);
}, dataType: "json", complete: poll, timeout: 30000 });
})();
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management

Here's all you have to do to add clustering to your node.js application.

  • save this code as cluster.js, and run cluster.js instead of server.js (or /bin/www, or whatever it's called for your project)
  • the only line you'll need to change is the last line - it needs to point to the location of your server.js file
var cluster = require('cluster');

if (cluster.isMaster) {
  // Count the machine's CPUs
 var cpuCount = require('os').cpus().length;
var gulp = require('gulp'),
compass = require('gulp-compass'),
gutil = require('gulp-util'),
chalk = require('chalk'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
imagemin = require('gulp-imagemin'),
pngquant = require('imagemin-pngquant'),
elixir = require('laravel-elixir'),