Skip to content

Instantly share code, notes, and snippets.

View bobbysciacchitano's full-sized avatar

Bobby Sciacchitano bobbysciacchitano

View GitHub Profile
export function useTitle(title?: string | string[]) {
useEffect(() => {
if (title) {
document.title = `${
Array.isArray(title) ? title.join(" | ") : title
} | Fitness`;
}
return () => {
@bobbysciacchitano
bobbysciacchitano / foo.go
Last active April 8, 2019 06:33
Just a basic web server in golang :)
package main
import (
"context"
"encoding/json"
"fmt"
"net/http"
_ "github.com/go-kivik/couchdb"
"github.com/go-kivik/kivik"
@bobbysciacchitano
bobbysciacchitano / gist:7d1a6b270854a8122a3d4e895f7dd08a
Last active November 28, 2016 22:31
A friendly reminder about experts
A conversation from F for Fake (1973)
Clifford Irving: I've known Elmyr for about eight years. We met when I was broke. When I was writing fiction. I wasn't selling it very well.
Orson Welles: His fiction didn't sell. Elmyr's biographer's a highly gifted writer. Does it say something for this age of ours that he could only make it big by fakery?
Elmyr de Hory: Le grande surprise!
Orson Welles: Cliff Irving's caper may well be the hoax of the century, but, really, this is not, you know, in any way the century of the hoax. We hanky-panky men have always been with you.
@bobbysciacchitano
bobbysciacchitano / gist:471e1525ef08c0f8fc6a
Last active August 29, 2015 14:25
Install Sentry with MySQL
# VIA http://blog.jesse-obrien.ca/post/add-beautiful-and-effective-exception-handling-to-laravel-with-sentry
# Debian/Ubuntu
$ sudo apt-get install git supervisor htop python2.7-dev libxslt1-dev libxml2-dev libz-dev libffi-dev libssl-dev libmysqlclient-dev
# Get the latest version of Setup Tools
$ wget https://bootstrap.pypa.io/ez_setup.py -O - | python
# Install sentry itself and the python-mysql dependencies
$ sudo easy_install -UZ sentry[mysql]
@bobbysciacchitano
bobbysciacchitano / gist:8af6872e14dd37ab802f
Created April 26, 2015 10:32
Express CORS Middleware
var middleware = function(request, response, next) {
response.header("Access-Control-Allow-Origin", "*");
response.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, Authorization");
response.header("Access-Control-Allow-Methods", "GET, PUT, POST, DELETE");
response.header("Access-Control-Max-Age", "432000");
if(request.method === 'OPTIONS') {
@bobbysciacchitano
bobbysciacchitano / Capfile
Created October 15, 2014 10:45
Ember-CLI Capistrano deploy
# Move config files to prevent conflicts with project
set :deploy_config_path, 'deploy/config/deploy.rb'
set :stage_config_path, 'deploy/config/deploy'
# Load DSL and Setup Up Stages
require 'capistrano/setup'
# Includes default deployment tasks
require 'capistrano/deploy'
@bobbysciacchitano
bobbysciacchitano / gist:b183b873b61fc8948b70
Last active August 29, 2015 14:07
Useful Ember tricks
// Refresh a route:
// In the route you want to refresh, you can place the following into an action:
this.refresh();
@bobbysciacchitano
bobbysciacchitano / gist:7008bbd15fc2aac7e7da
Created October 5, 2014 03:31
Useful Laravel REST API Snippets
/*
|--------------------------------------------------------------------------
| REST API default headers
|--------------------------------------------------------------------------
|
| Adds extra headers for handling API requests.
|
*/
App::after(function($request, $response)
Feature: Donation
As a Movember member I want to make a donation to an individual or a team
Scenario Outline: As a member I want to make a general donation to an individual - Providing first name and last name for donation receipt
Given I am on "<path>" secure page
When I click "<button>"
Then the value of "input[name=donationAmount]" should be "<amount>"
@bobbysciacchitano
bobbysciacchitano / gist:5234729
Created March 25, 2013 03:25
Allocate swap space on Linux server.
sudo fallocate -l 512m /mnt/512mb.swap
sudo mkswap /mnt/512mb.swap
sudo swapon /mnt/512mb.swap