Skip to content

Instantly share code, notes, and snippets.

View JeffreyWay's full-sized avatar

Jeffrey Way JeffreyWay

View GitHub Profile
@JeffreyWay
JeffreyWay / gist:3185773
Created July 27, 2012 02:01
PHP Installation Options
./configure \
--prefix=/usr \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--sysconfdir=/private/etc \
--with-apxs2=/usr/sbin/apxs \
--enable-cli \
--with-config-file-path=/etc \
--with-libxml-dir=/usr \
--with-openssl=/usr \
@JeffreyWay
JeffreyWay / set-value.md
Created July 28, 2012 19:09
PHP: Set value if not exist

You know how, in JavaScript, we can set a value to a variable if one doesn't, like this:

name = name || 'joe';

This is quite common and very helpful. Another option is to do:

name || (name = 'joe');
// Any way to merge these in Backbone?
this.collection.on('thing', this.something, this);
this.collection.on('thing', this.anotherThing, this);
@JeffreyWay
JeffreyWay / snippet.xml
Created September 13, 2012 20:23
Laravel Resource - Sublime Text 2 Snippet
<snippet>
<content><![CDATA[
// ${1} Resource
Route::get('${1}s', array('as' => '${1}s', 'uses' => '${1}s@index'));
Route::get('${1}s/(:any)', array('as' => '${1}', 'uses' => '${1}s@show'));
Route::get('${1}s/new', array('as' => 'new_${1}', 'uses' => '${1}s@new'));
Route::get('${1}s/(:any)edit', array('as' => 'edit_${1}', 'uses' => '${1}s@edit'));
Route::post('${1}s', '${1}s@create');
Route::put('${1}s/(:any)', '${1}s@update');
Route::delete('${1}s/(:any)', '${1}s@destroy');
@JeffreyWay
JeffreyWay / main.js
Created October 27, 2012 20:25 — forked from jacekd/main.js
*
$(window).scroll(function() {
var scroll = $(window).scrollTop();
if (scroll > 50) {
$(".menu-bar").addClass("menu-bar-scroll");
} else {
$(".menu-bar").removeClass("menu-bar-scroll");
}
});
(function(){
@JeffreyWay
JeffreyWay / main.js
Created October 27, 2012 20:25 — forked from jacekd/main.js
*
$(window).scroll(function() {
var scroll = $(window).scrollTop();
if (scroll > 50) {
$(".menu-bar").addClass("menu-bar-scroll");
} else {
$(".menu-bar").removeClass("menu-bar-scroll");
}
});
(function(){
@JeffreyWay
JeffreyWay / main.js
Created October 27, 2012 20:26 — forked from jacekd/main.js
*
(function(){
var menuBar = $(".menu-bar ul");
var menuActive = menuBar.find("li.active");
menuBar.hover(function() {
menuActive.toggleClass("active");
});
})();
// Which do you prefer more?
// trigger event and get out
var vent = _.extend({}, Backbone.Events);
App.Router = Backbone.Router.extend({
routes: {
'show/:id': 'show'
},
show: function(id) {