Skip to content

Instantly share code, notes, and snippets.

View ericvanjohnson's full-sized avatar
🐘
Probably doing PHP Stuff.

Eric Van Johnson ericvanjohnson

🐘
Probably doing PHP Stuff.
View GitHub Profile
@ericvanjohnson
ericvanjohnson / randomRSVP.php
Last active August 29, 2015 14:00
Wrote a quick PHP Script to randomly select a member of our SDPHP User Group using the MeetUp API and polling all the members who RSVP for an Event. This version is designed to run from the command like ```php randomRSVP.php``` Thanks to @johncongdon for "making it work"
# Create Composer file and add MeetUp API PAckage
composer init --require="dms/meetup-api-client:~1.0"
# Install packages
composer install

Keybase proof

I hereby claim:

  • I am ericvanjohnson on github.
  • I am ericvanjohnson (https://keybase.io/ericvanjohnson) on keybase.
  • I have a public key whose fingerprint is 4D73 43BE B646 1830 61A9 6FEE 68F1 5AD4 B2E5 B977

To claim this, I am signing this object:

Verifying myself: My Bitcoin username is +shocm. https://onename.io/shocm
@ericvanjohnson
ericvanjohnson / php-lint.php
Last active August 29, 2015 14:05
PHP Linting a Pre Commit Git Hook
#!/usr/local/bin/php
<?php
# PHP LINTING
$output = array();
$return = 0;
exec('git rev-parse --verify HEAD 2> /dev/null', $output, $return);
$against = $return == 0 ? 'HEAD' : '4b825dc642cb6eb9a060e54bf8d69288fbee4904';
exec("git diff-index --diff-filter=ACMRTUXB --cached --name-only {$against}", $output);
<?php
use Carbon\Carbon;
// User passes in start and end dates as YYYY-MM-DD .. Example 2015-06-16
// Get the beginning of the day timestamp
$start = Carbon::parse($this->option('start'))->startOfDay()->timestamp;
// Get the end of the day timestamp
$end = Carbon::parse($this->option('end'))->endOfDay()->timestamp;
@ericvanjohnson
ericvanjohnson / redmine.sh
Created July 28, 2015 17:52
ZSH Plugin to open Redmine tickets from the Command Line
# To use: add a .redmine-url file in the base of your project
# You can also set redmine_URL in your .zshrc or put .redmine-url in your home directory
# .redmine-url in the current directory takes precedence
#
# If you use Rapid Board, set:
#redmine_RAPID_BOARD="true"
# in you .zshrc
#
# Setup: cd to/my/project
# echo "https://name.redmine.com" >> .redmine-url
@ericvanjohnson
ericvanjohnson / x
Created May 28, 2009 03:47
Ubiquity command the involks the HootSuite Bookmarklet
CmdUtils.makeBookmarkletCommand({
name: 'send-to-hootlet',
icon: "http://static.hootsuite.com/images-3-7-0/favicon.ico",
homepage: "http://www.esolves.com",
author: { name: "Eric Van Johnson", email: "eric@esolves.com"},
license: "GPL",
description: "Sends URL to post via Hootsuite.com",
help: "Type 'send-to-hootlet",
url: "javascript:var%20d=document,w=window,e=w.getSelection,f='http://hootsuite.com/twitter/bookmark-tool-v2?',l=d.location,e=encodeURIComponent,p='address='+e(l.href)+'&title='+escape(d.title),u=f+p;a=function(){if(!w.open(u,'t','scrollbars=1,toolbar=0,location=0,resizable=0,status=0,width=555,height=570'))l.href=u;};if(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else%20a();void(0);",
}
# Good source for gitignore examples
# https://github.com/github/gitignore
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
var http = require('http');
var pg = require('pg');
var connectionString = "pg://chartjes:********@localhost:5432/ibl_stats";
pg.connect(connectionString, function(err, client) {
if (err) {
console.log(err);
} else {
http.createServer(function(request, response) {
response.writeHead(200, {'Content-Type': 'text/html'});
@ericvanjohnson
ericvanjohnson / gist:2714758
Created May 16, 2012 23:05
.htaccess 301 Redirect
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule (.*) http://newurl.com/$1 [R=301,L]
</IfModule>