Skip to content

Instantly share code, notes, and snippets.

View steveoliver's full-sized avatar

Steve Oliver steveoliver

View GitHub Profile
@demisx
demisx / _angularjs-1-component-organization.md
Last active July 14, 2023 14:07
AngularAtom--Component-based organization for AngularJS 1.x apps. Read more on AngularAtom organization at http://demisx.github.io/angularjs/atom/component-feature-based-organization/2014/12/02/angular-1-component-organization-1.html

Angular application directory structure

Leverages Angular UI Router instead of core ngRoute module. UI Router allows us to organize our application interface into a state machine. Unlike the $route service in the Angular ngRoute module, which is organized around URL routes, UI-Router is organized around states, which may optionally have routes, as well as other behavior, attached.

LIFT* Organization principle:

  • L - Locating code easy
  • I - Identify code at a glance
@mlynch
mlynch / autofocus.js
Last active August 24, 2022 15:03
AngularJS Autofocus directive
/**
* the HTML5 autofocus property can be finicky when it comes to dynamically loaded
* templates and such with AngularJS. Use this simple directive to
* tame this beast once and for all.
*
* Usage:
* <input type="text" autofocus>
*
* License: MIT
*/
@stephanetimmermans
stephanetimmermans / ubuntu-compass-ruby
Last active July 4, 2019 12:48
Install Compass+Ruby on Ubuntu 14.04
#https://gorails.com/setup/ubuntu/14.04
sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties
sudo apt-get install libgdbm-dev libncurses5-dev automake libtool bison libffi-dev
curl -L https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
echo "source ~/.rvm/scripts/rvm" >> ~/.bashrc
rvm install 2.1.2
rvm use 2.1.2 --default
alias dreset='cd `drush dd` && drush sql-drop -y && sudo rm -rf sites/default/files sites/default/settings.php && mkdir sites/default/files && cp sites/default/default.settings.php sites/default/settings.php && chmod -R 777 sites/default/files sites/default/settings.php'
anonymous
anonymous / relation_select_insert.php
Created October 2, 2012 16:29
Drupal Relation Select insert() hook patch
<?php
/**
* Save an instance of a Relation Select field.
*
* Implements hook_field_insert().
*/
function relation_select_field_insert($entity_type, $entity, $field, $instance, $langcode, &$items){
$relation_type = relation_type_load($instance['settings']['relation_type']);
list($entity_id) = entity_extract_ids($entity_type, $entity);
@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

@rfay
rfay / gist:1398086
Created November 27, 2011 20:20
My nginx rewrite
server {
listen 80;
#server_name ~^($<domain>.*)\.l\/.*$;
server_name ~^(www\.)?(?<domain>.+)\.(l|bigsony|b)$;
#gzip off;
root /home/rfay/workspace/$domain;
fastcgi_read_timeout 1200;
fastcgi_send_timeout 1200;
client_max_body_size 128m;