Skip to content

Instantly share code, notes, and snippets.

View fideloper's full-sized avatar
🏠
Working from home

Chris Fidao fideloper

🏠
Working from home
View GitHub Profile
@moklett
moklett / openconnect.md
Created July 24, 2012 15:21
OpenConnect VPN on Mac OS X

Unfortunately, the Cisco AnyConnect client for Mac conflicts with Pow. And by "conflicts", I mean it causes a grey-screen-of-death kernel panic anytime you connect to the VPN and Pow is installed.

As an alternative, there is OpenConnect, a command-line client for Cisco's AnyConnect SSL VPN.

Here's how to get it set up on Mac OS X:

  1. OpenConnect can be installed via homebrew:

     brew update
    

brew install openconnect

@EpocSquadron
EpocSquadron / gist:2936983
Last active October 6, 2015 04:37
Web Project Best Practices

Web Project Best Practices

Proper Gitignoring

When starting a project, or joining a project that hasn't done this yet, the first thing you should do is set up proper gitignore files. There should be a master gitignore in the project root based on the h5bp master gitignore, and a cache dir specific gitignore in each cache directory. Without proper gitignoring, junk files tend to find their way into commits and removing them becomes a pain, as everyone gets modified/removed conflicts forever after. The reasoning behind using a gitignore file for each cache folder separately instead of including path/to/cache_dir/* in the master gitignore is that git is inconsistent in whether the folder itself is actually stored in the remote git repo. It is most consistent to have gitignores ignoring all but themselves in each cache directory. Then that directory must always be in the remote repo in order to contain the .gitignore file.

@EpocSquadron
EpocSquadron / .htaccess
Created May 8, 2012 15:39
Htaccess snippet for selective simple auth on staging environment.
# ##############################################################################
# # HTTP AUTH FOR NON-PRODUCTION PUBLIC SITES #
# ##############################################################################
# Set environment variable based on Host
SetEnvIfNoCase Host \.local(:80)?$ APPLICATION_ENV=development
SetEnvIfNoCase Host ^(www\.)?stagingaddress\.com(:80)?$ APPLICATION_ENV=staging
SetEnvIfNoCase Host ^(www\.)?productionaddress\.com(:80)?$ APPLICATION_ENV=production
# Check for staging so we can set DENIABLE_HOST variable
@HansCz
HansCz / list_apache2_vhosts.bash
Created April 13, 2012 11:30
Apache (Bash) - List apache2 virtualhosts
# List apache2 virtualhosts
# Lists virtualhosts currently enabled for apache2,
# showing the ServerName:port, conf file and DocumentRoot
/usr/sbin/apache2ctl -S 2>&1 | perl -ne 'm@.*port\s+([0-9]+)\s+\w+\s+(\S+)\s+\((.+):.*@ && do { print "$2:$1\n\t$3\n"; $root = qx{grep DocumentRoot $3}; $root =~ s/^\s+//; print "\t$root\n" };'
@JeffreyWay
JeffreyWay / gist:1525217
Created December 27, 2011 21:29
Instant Server for Current Directory
alias server='open http://localhost:8000 && python -m SimpleHTTPServer'
@airways
airways / mod.extendedchannel.php
Created October 28, 2011 15:52
ExpressionEngine: Extending a core or third party module or plugin
<?php
class ExtendedChannel {
public __construct()
{
$this->EE = &get_instance();
}
public function extended_entries()
{
@necolas
necolas / snippet.js
Created June 14, 2011 20:36
Optimised async loading of cross-domain scripts
/*
* Updated to use the function-based method described in http://www.phpied.com/social-button-bffs/
* Better handling of scripts without supplied ids.
*
* N.B. Be sure to include Google Analytics's _gaq and Facebook's fbAsyncInit prior to this function.
*/
(function(doc, script) {
var js,
fjs = doc.getElementsByTagName(script)[0],
@joemccann
joemccann / nginx + node setup.md
Created October 25, 2010 02:06
Set up nginx as a reverse proxy to node.js.

The idea is to have nginx installed and node installed. I will extend this gist to include how to install those as well, but at the moment, the following assumes you have nginx 0.7.62 and node 0.2.3 installed on a Linux distro (I used Ubuntu).

In a nutshell,

  1. nginx is used to serve static files (css, js, images, etc.)
  2. node serves all the "dynamic" stuff.

So for example, www.foo.com request comes and your css, js, and images get served thru nginx while everything else (the request for say index.html or "/") gets served through node.

  1. nginx listens on port 80.