Skip to content

Instantly share code, notes, and snippets.

View ikbelkirasan's full-sized avatar

Ikbel ikbelkirasan

View GitHub Profile
@KidA78
KidA78 / gist:fb7cde34a9481f7ab22d9998e6a450cf
Last active March 3, 2021 11:35
Vue.js Component Inheritance Example
<!-- Markup -->
<!-- Components get injected here dynamically -->
<component
v-for="w in dashboardWidgets"
:is="w.type">
</component>
<!-- Base Widget Template -->
<script type="text/x-template" id="template-base">
<div class="grid-item widget {{widgetName}}">
@ikbelkirasan
ikbelkirasan / distance_from_polygon.cpp
Created July 26, 2016 06:44 — forked from atduskgreg/distance_from_polygon.cpp
Find the distance from a polygon using the Bourke line-distance algorithm for each segment. Example of it in action here: http://itp.nyu.edu/~gab305/files/gif_with_blurred_borders.gif
// example of this in action here: http://itp.nyu.edu/~gab305/files/gif_with_blurred_borders.gif
float testApp::distanceFromLine(const ofPoint & p, const ofPoint & l1, const ofPoint & l2){
float xDelta = l2.x - l1.x;
float yDelta = l2.y - l1.y;
// final double u = ((p3.getX() - p1.getX()) * xDelta + (p3.getY() - p1.getY()) * yDelta) / (xDelta * xDelta + yDelta * yDelta);
float u = ((p.x - l1.x) * xDelta + (p.y - l1.y)*yDelta) / (xDelta * xDelta + yDelta * yDelta);
ofPoint closestPointOnLine;
@thomasjsn
thomasjsn / laravel-queue.service
Last active August 20, 2025 15:41
Laravel queue worker using systemd.
# Laravel queue worker using systemd
# ----------------------------------
#
# /lib/systemd/system/queue.service
#
# run this command to enable service:
# systemctl enable queue.service
[Unit]
Description=Laravel queue worker
@sebastiaanluca
sebastiaanluca / NewMessage.php
Last active January 29, 2025 12:47
Laravel + Redis + NodeJS + Socket.io pub/sub secure server and client supporting multiple rooms, channels, users, … Add `client.js` to your client app, run `node server.js`, and trigger the Laravel event any way you want to broadcast the data.
<?php
namespace App\Events;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Queue\SerializesModels;
class NewMessage extends Event implements ShouldBroadcast
{
@thefekete
thefekete / gnome-ext-install.sh
Created April 26, 2016 16:52
Bash script to install extensions from the command line. *Use at your own risk!*
#!/bin/bash
set -e
set -u
version="0.0"
usage="$(basename $0) version $version
usage:
$(basename $0) install <extension-uuid> [<extension-id/uuid> ... ]
@cybersamx
cybersamx / ssh-key-generation.md
Last active October 30, 2025 12:08
Generate a new SSH key pair

Mac and Linux

  • Open Terminal

  • Check if you already have a SSH keypair generated. Do the following:

    $ ls -la ~/.ssh/id_rsa*
    

If the files exist, you already have SSH installed. IMPORTANT: But if you wish to regenerate the SSH key pair, at least back up your old SSH keys.

@NathanQ
NathanQ / squarespacePopup.js
Last active November 13, 2017 15:01
Squarespace Add Popup Video To Background Image Modules using YUI, not jQuery
YUI().use('node', 'event', function (Y) { // use squarespace's preloaded YUI instead of loading jQuery just to make a popup. add this to the footer of your page in a snippet.
var videoLink = ''; // link your links to their videos in the content.
var top = pageYOffset;
var body = Y.one('body');
var obj;
var doClose = function(e) {
e.preventDefault();
var videoContent = document.getElementById('videoContent');
videoContent.parentNode.removeChild(videoContent);
Y.one('body').removeClass('sqs-lightbox-open');
@DavideMontersino
DavideMontersino / private-fork.md
Last active September 27, 2025 23:26
How to fork to a private gitlab instance

Theory:

your git repository can have more than one remote server; In this case we want to have two:

  1. one for our private repository on gitlab (will be the default one, called origin)
  2. one to be connected to the source repo on github, to be able to pull new changes (will be called upstream)

How to make a private fork from github to gitlab

@s-leroux
s-leroux / Makefile
Last active January 30, 2023 15:56
Running a nested xfce4-session in Xephyr
all: pts grantpt ptsname unlockpt
// REGISTER WORKER
"use strict";
"serviceWorker" in navigator && navigator.serviceWorker.register("sw?v=${java.net.URLEncoder.encode(serviceWorkerVersion)} /* WORKER_URL */", {
scope: "./"
}).then(function(e) {
"function" == typeof e.update && e.update(), e.onupdatefound = function() {
var o = e.installing;
o.onstatechange = function() {
switch (o.state) {