Skip to content

Instantly share code, notes, and snippets.

View devNigel's full-sized avatar
🎯
Focusing

nigel devNigel

🎯
Focusing
View GitHub Profile
@devNigel
devNigel / WP Customizer - Textarea
Created November 8, 2019 16:44 — forked from ajskelton/WP Customizer - Textarea
Add a Textarea field to the WordPress Customizer.
$wp_customize->add_setting( 'themeslug_textarea_setting_id', array(
'capability' => 'edit_theme_options',
'default' => 'Lorem Ipsum Dolor Sit amet',
'sanitize_callback' => 'sanitize_textarea_field',
) );
$wp_customize->add_control( 'themeslug_textarea_setting_id', array(
'type' => 'textarea',
'section' => 'custom_section', // // Add a default or your own section
'label' => __( 'Custom Text Area' ),
@devNigel
devNigel / django_deploy.md
Created January 6, 2019 10:57 — forked from bradtraversy/django_deploy.md
Django Deployment - Digital Ocean

Django Deployment to Ubuntu 18.04

In this guide I will go through all the steps to create a VPS, secure it and deploy a Django application. This is a summarized document from this digital ocean doc

Any commands with "$" at the beginning run on your local machine and any "#" run when logged into the server

Create A Digital Ocean Droplet

Use this link and get $10 free. Just select the $5 plan unless this a production app.

In this article I'm going to walk you through process of creating Wordpress plugins. First I'm going to talk about some of the basic concepts in Wordpress plugin development like the actions, hooks, and API's that makes up Wordpress. Then were going to build a plugin where we apply some of the concepts and best practices in developing Wordpress plugins.

###Prerequisites

In order to fully benefit from this tutorial you should have a basic knowledge on PHP. As Wordpress is running on PHP and most of the code that we will be writing will be on PHP. A little bit of knowledge on HTML, CSS and JavaScript is also helpful but not required for this tutorial.

@devNigel
devNigel / script.js
Last active March 31, 2018 19:52
Beginner’s Guide to Converting a Javascript App to a Progressive Web App (PWA)
const alertBox = document.getElementById("updateNotification");
const updateButton = document.getElementById("updateButton");
if ('serviceWorker' in navigator) {
window.addEventListener('load', function () {
navigator.serviceWorker.register('sw.js').then(function (registration) {
//check if page was loaded via service worker
if (!navigator.serviceWorker.controller) {
return;
}
@devNigel
devNigel / manifest.json
Last active March 31, 2018 17:18
Beginner’s Guide to Converting a Javascript App to a Progressive Web App (PWA)
{
"name": "TicTacToe PWA",
"short_name": "TicTacToe",
"icons": [{
"src": "icons/icon-128x128.png",
"sizes": "128x128",
"type": "image/png"
}, {
"src": "icons/icon-144x144.png",
"sizes": "144x144",
@devNigel
devNigel / script.js
Last active March 31, 2018 19:25
Beginner’s Guide to Converting a Javascript App to a Progressive Web App (PWA)
if ('serviceWorker' in navigator) {
window.addEventListener('load', function() {
navigator.serviceWorker.register('/sw.js').then(function(registration) {
// Registration was successful
console.log('ServiceWorker registration successful with scope: ', registration.scope);
}, function(err) {
// registration failed :(
console.log('ServiceWorker registration failed: ', err);
});
});
@devNigel
devNigel / sw.js
Last active March 31, 2018 16:08
Code snippets for Beginner’s Guide to Converting a Javascript App to a Progressive Web App (PWA)
var CACHE_NAME = 'tic-tac-toe-game-cache-v1';
//new
var urlsToCache = [
'/',
'style.css',
'script.js',
'3px-tile.png',
'https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js',
'https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.0/jquery-ui.min.js',
'https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css',