Skip to content

Instantly share code, notes, and snippets.

View johnantoni's full-sized avatar

John Griffiths johnantoni

View GitHub Profile
complete drawing
https://github.com/tomchentw/react-google-maps/issues/796
click-me popup
http://google-map-react.github.io/google-map-react/map/events
react leaflet
https://react-leaflet.js.org/en/
adding marker
@johnantoni
johnantoni / es6-promise.js
Created March 18, 2018 20:33
es6 promises
const save = () => {
return new Promise((resolve, reject) => {
// access the db
// save the file
// when the file is saved successfully
// resolve with the saved document
resolve(doc)
// if there was an error
reject(err)
@johnantoni
johnantoni / app.js
Last active March 14, 2018 17:41
react app.js
import React, { Component } from 'react';
import { Router, Route, Link, Redirect } from 'react-router-dom';
import { getCurrentUser } from './helpers';
class Home extends Component {
constructor(props) {
super(props);
this.state = {}
@johnantoni
johnantoni / postgresql + homebrew
Created February 22, 2011 23:55
postgres install with homebrew
brew install postgres
initdb /usr/local/var/postgres
psql postgres -c "create role postgres with login superuser"
psql postgres -c "alter user postgres with password 'password'"
@johnantoni
johnantoni / gist:5456815
Created April 25, 2013 01:11
apc install on bluehost shared hosting (php)
cd ~
mkdir modules apc
cd apc
wget http://pecl.php.net/get/APC-3.1.9.tgz
tar -xzvf APC-3.1.9.tgz
cd APC-3.1.9
phpize
./configure --enable-apc --enable-apc-mmap --with-apxs --with-php-config=/usr/bin/php-config
make
cd modules
@johnantoni
johnantoni / unicorn.rb
Created August 2, 2012 15:48
unicorn + nginx setup + ssl
unicorn.rb
-----------------------------------
application = "jarvis"
remote_user = "vagrant"
env = ENV["RAILS_ENV"] || "development"
RAILS_ROOT = File.join("/home", remote_user, application)
worker_processes 8
timeout 30
@johnantoni
johnantoni / sftp.synology.txt
Created May 18, 2012 21:34
sftp on synology disk station - ds411-ii
ssh root@nas.mybox.com
vi /etc/ssh/sshd_config
# override default of no subsystems
#Subsystem sftp /usr/libexec/sftp-server
Subsystem sftp internal-sftp
# restart ssh
@johnantoni
johnantoni / .htaccess
Created December 28, 2012 14:59
.htaccess for wordpress
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
@johnantoni
johnantoni / setAllToMaxHeight
Created April 13, 2011 13:01
setAllToMaxHeight (jquery)
$.fn.setAllToMaxHeight = function(){
return this.height( Math.max.apply(this, $.map( this , function(e){ return $(e).height() }) ) );
}
// usage: $(‘div.unevenheights’).setAllToMaxHeight()
// http://www.broken-links.com/2009/01/20/very-quick-equal-height-columns-in-jquery/
@johnantoni
johnantoni / com.docker.boot2docker.plist
Last active March 30, 2017 08:11
run boot2docker on system startup - Mac OSX - Yosemite
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.docker.boot2docker</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/boot2docker</string>
<string>up</string>