Skip to content

Instantly share code, notes, and snippets.

View nethoncho's full-sized avatar
🍊

Net Honcho nethoncho

🍊
View GitHub Profile
@nethoncho
nethoncho / README.md
Created March 22, 2018 09:07 — forked from ErisDS/README.md
Deployment tools for Ghost themes

Gulp tools to deploy a Ghost theme

To set it up:

  • copy gulp-config.json.example to gulp-config.json
  • enter the blog admin url, no trailing slash, e.g. https://myblog.ghost.io
  • grab the client secret for the frontend from the source of any page of the blog
  • enter the email address & password you use to login to the blog (must be administrator-level)

To deploy:

@nethoncho
nethoncho / ! pg-migrate-demo
Last active October 25, 2017 03:27
Postgresql database migration management
# https://github.com/salsita/node-pg-migrate
npm install node-pg-migrate
/*
* config/bootstrap.js
* Example of how to redirect all http request to https
* See http://jsbot.io/node/http-and-https-handle-with-sailsjs
*
*/
module.exports.bootstrap = function(cb) {
var express = require("express")
var app = express();
@nethoncho
nethoncho / debounceExample.js
Last active August 29, 2015 14:15
angular debounce example
// Example from https://scotch.io/tutorials/making-skinny-angularjs-controllers
// Search the goat database
$scope.searchGoats = _.debounce(function(query) {
$http.get('/goats/search/' + query)
.then(function(response) {
$scope.goats = response.data;
});
}, 300);
@nethoncho
nethoncho / inet_aton.php
Last active October 10, 2024 19:47
JavaScript inet_aton
// http://stackoverflow.com/a/21559595
// ip example: 192.168.2.1
function inet_aton(ip){
// split into octets
var a = ip.split('.');
var buffer = new ArrayBuffer(4);
var dv = new DataView(buffer);
for(var i = 0; i < 4; i++){
dv.setUint8(i, a[i]);
}
@nethoncho
nethoncho / find_network_test.php
Last active November 8, 2019 00:32
PHP: Find Network and Broadcast for given IP and Subnet
#!/usr/bin/php
<?php
$input = new stdClass();
$input->ip = '70.71.72.73';
$input->netmask = '255.255.255.0';
$input->ip_int = ip2long($input->ip);
$input->netmask_int = ip2long($input->netmask);
// Network is a logical AND between the address and netmask