Skip to content

Instantly share code, notes, and snippets.

Avatar

James Myers absolutelynotjames

  • Durham College
  • Greater Toronto Area
View GitHub Profile
@soheilhy
soheilhy / nginxproxy.md
Last active Nov 29, 2021
How to proxy web apps using nginx?
View nginxproxy.md

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@pospi
pospi / leaflet-multi-geojson-layers.js
Last active Sep 23, 2016
Handle multiple geoJSON layers in a Leaflet.js angular directive
View leaflet-multi-geojson-layers.js
/**
* Service to manage geoJSON layering with Leaflet.js' angular directive, which only allows 1 set of geoJSON data.
*
* Assuming you have a leaflet directive with its 'geojson' attribute set to `geojson`, usage is as follows:
* var layers = new GeoJSONLayers();
*
* layers.addLayer('myLayer', geoJSON, function(feature) { return { fillColor: '#00F' }; });
* $scope.geojson = layers.get();
*
* layers.removeLayer('myLayer');
@sogko
sogko / app.js
Last active Nov 27, 2021
gulp + expressjs + nodemon + browser-sync
View app.js
'use strict';
// simple express server
var express = require('express');
var app = express();
var router = express.Router();
app.use(express.static('public'));
app.get('/', function(req, res) {
res.sendfile('./public/index.html');
View custom_wp_scripts_styles.php
/*
The trick to this whole thing is the cache busting "filemtime()" function.
It takes the file creation time and makes that the version number.
So, we don't have to keep track of versions and it will always be unique.
*/
// You don't have to define this stuff, but it can be useful for later since we reference them so much.
define( 'THEME_DIR_URI', get_template_directory_uri() );
define( 'THEME_DIR', get_template_directory() );
@noelboss
noelboss / git-deployment.md
Last active Nov 30, 2021
Simple automated GIT Deployment using Hooks
View git-deployment.md

Simple automated GIT Deployment using GIT Hooks

Here are the simple steps needed to create a deployment from your local GIT repository to a server based on this in-depth tutorial.

How it works

You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use a service like deepl.io to act upon a Web-Hook that's triggered that service.