Skip to content

Instantly share code, notes, and snippets.

View bugzbrown's full-sized avatar

Gregory Brown bugzbrown

View GitHub Profile
@bugzbrown
bugzbrown / bootstrap.sh
Last active December 16, 2015 09:49
My Vagrant bootstrap for setting up a basic Ubuntu64 && rails machine
#!/bin/bash
apt-get -y update
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline5-dev libyaml-dev zsh
cd /tmp
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p392.tar.gz
tar -xvzf ruby-1.9.3-p392.tar.gz
cd ruby-1.9.3-p392
./configure --prefix=/usr/local
make
make install
File: adm/category.rb
=====================
class Adm::Category < ActiveRecord::Base
has_one :adm_modalcategory
end
File: adm/modalcategory.rb
==========================
server {
listen 80;
server_name serasa.vbeta.com.br;
underscores_in_headers on;
location / {
proxy_pass http://192.170.0.216;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass_request_headers on;
@bugzbrown
bugzbrown / index.js
Created October 22, 2017 06:01
Simple node app for Medium Article
// Import express
const express = require('express');
const app = express();
app.get('/', (req, res) => {
res.send('<h1>Hello World from Node</h1>');
})
app.listen(3000,() => {
console.log('Listening on port 3000');
@bugzbrown
bugzbrown / mysql.js
Created November 1, 2017 02:28
MySQL helper for node apps
var mysql = require('mysql')
, async = require('async')
, config = require('config');
var state = {
pool: null,
mode: null,
}
exports.connect = function(done) {
@bugzbrown
bugzbrown / run.sh
Last active December 3, 2017 17:16
Quick start for running GhostBlog on your computer with docker
#!/bin/env bash
MY_PATH=$(pwd)
PORT=${1:-8080}
docker run -p $PORT:2368 -v $MY_PATH:/var/lib/ghost/content --env NODE_ENV=development ghost
@bugzbrown
bugzbrown / Plugin.php
Last active July 7, 2021 11:43
Get Plugin System Settings from your templates with a twig extension in OctoberCMS
/*
* In your plugin.php file add the following function
*/
<?php
//...
public function registerMarkupTags()
{
return [
'functions' => [
@bugzbrown
bugzbrown / mysqlfix.md
Created June 4, 2019 01:20
Step by step fix for mysql problems on mac.

FIX MYSQL INSTALL ON MAC

Make sure You have open ssl

brew install openssl

If you are installing Mysql 8:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Imported Rule 1" stopProcessing="true">
<match url="themes/.*/(layouts|pages|partials)/.*.htm" />
<action type="Rewrite" url="index.php" />
</rule>
<rule name="Imported Rule 2" stopProcessing="true">
@bugzbrown
bugzbrown / lat-long.js
Created November 5, 2019 21:56
calcular distância entre 2 pontos num mapa
function distance(lat1, lon1, lat2, lon2, unit) {
if ((lat1 == lat2) && (lon1 == lon2)) {
return 0;
}
else {
var radlat1 = Math.PI * lat1/180;
var radlat2 = Math.PI * lat2/180;
var theta = lon1-lon2;
var radtheta = Math.PI * theta/180;
var dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);