Skip to content

Instantly share code, notes, and snippets.

Avatar
🚲
Drifting away...

Dorell James dorelljames

🚲
Drifting away...
View GitHub Profile
View machine.js
Machine({
id: "electricFan",
type: "parallel",
states: {
power: {
id: "power",
initial: "turnedOff",
states: {
turnedOff: {
on: {
View machine.js
const trafficLightMachine = Machine({
id: "trafficLight",
initial: "red",
on: {
NEXT: "green"
}
})
@dorelljames
dorelljames / webtask-io-scrollable.md
Created Sep 10, 2019
Make webtask.io "Explorer" sidebar scrollable
View webtask-io-scrollable.md

Objective

Fix the annoying Explorer sidebar of webtask.io and make it scrollable. 😊

How?

I use Google Chrome browser so I installed User CSS extension which basically allows one to add custom CSS to add a website.

Here's the custom css to add:

@dorelljames
dorelljames / README.md
Created Aug 22, 2019 — forked from pbojinov/README.md
Two way iframe communication- Check out working example here: http://pbojinov.github.io/iframe-communication/
View README.md

Two way iframe communication

The main difference between the two pages is the method of sending messages. Recieving messages is the same in both.

Parent

Send messages to iframe using iframeEl.contentWindow.postMessage Recieve messages using window.addEventListener('message')

iframe

View App.js
import React from "react";
import axios from "axios";
class App extends React.Component {
constructor() {
super();
this.state = {
todos: [],
isFetching: true
};
@dorelljames
dorelljames / adding-messenger-customer-chat-plugin-to-your-site.md
Last active Nov 30, 2017
Adding Messenger Customer Chat Plugin To Your Site
View adding-messenger-customer-chat-plugin-to-your-site.md

Requirements

  1. Install the Facebook SDK on your website.
<script>
  window.fbAsyncInit = function() {
    FB.init({
      appId            : '1678638095724206', // REPLACE IF YOU WANT TO USE YOUR OWN FB APP
      autoLogAppEvents : true,
@dorelljames
dorelljames / osx-vscode-xdebug-configuration.md
Last active Mar 10, 2021
OS X: Configuring XDebug on Visual Studio Code
View osx-vscode-xdebug-configuration.md

OS X (MacOS): Configuring XDebug on Visual Studio Code

This guide is intended to get you up and running with XDebug for Visual Studio Code on OS X.

My Setup

  • Visual Studio Code (Insiders) 1.10.0
  • OSX El Capitan 10.11.6
  • PHP 7.0.15 (installed via homebrew)
  • XDebug 2.5.0 (installed via homebrew)
@dorelljames
dorelljames / AbanteCartValetDriver.php
Last active Feb 20, 2019
Laravel Valet Driver for AbanteCart. Save this file to ~/.valet/Drivers/ or ~/.config/valet/Drivers on new version
View AbanteCartValetDriver.php
<?php
class AbanteCartValetDriver extends ValetDriver
{
/**
* Determine if the driver serves the request.
*
* @param string $sitePath
* @param string $siteName
* @param string $uri
@dorelljames
dorelljames / laravel-nginx-config-make-http-exception-url-and-make-all-others-https.md
Last active Mar 25, 2021
Laravel nginx config to redirect all requests to https and an exception URL that can still be accessible via http
View laravel-nginx-config-make-http-exception-url-and-make-all-others-https.md

Pre-condition

One day in your Laravel app, you were required to redirect all http requests to https but need to make a certain URL route accessible via http for a certain reason; perhaps a portion of your javascript code needs to redirect to http URL but it can't because redirection to secure URL to insecure is prohibited. Therefore, in cases like this, you need to just allow just one URL to make an http connection.

NOTE: There are obvious security implications here so don't just follow this blindly and understand if this is really the solution you're looking for. The nginx config can somehow be improved, I just don't have the time yet. It sure do look redundant.

Understanding and examples

  • Redirect everything from http to https