Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
| # http://henrik.nyh.se/2008/12/git-dirty-prompt | |
| # http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/ | |
| # username@Machine ~/dev/dir[master]$ # clean working directory | |
| # username@Machine ~/dev/dir[master*]$ # dirty working directory | |
| function parse_git_dirty { | |
| [[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*" | |
| } | |
| function parse_git_branch { | |
| git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/" |
| The regex patterns in this gist are intended to match any URLs, | |
| including "mailto:foo@example.com", "x-whatever://foo", etc. For a | |
| pattern that attempts only to match web URLs (http, https), see: | |
| https://gist.github.com/gruber/8891611 | |
| # Single-line version of pattern: | |
| (?i)\b((?:[a-z][\w-]+:(?:/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’])) |
| #!/bin/sh | |
| # Check if the individual developer has his own hook | |
| CMD_NAME=`basename $0` | |
| if [ -f $GIT_DIR/hooks/personal/$CMD_NAME ] | |
| then | |
| # If so, run it. $@ passes all the command line arguments passed to this function | |
| # If the personal hook fails, fail this one as well | |
| if ! $GIT_DIR/hooks/personal/$CMD_NAME $@ | |
| then |
| // Provides a device_scale class on iOS devices for scaling user | |
| // interface elements relative to the current zoom factor. | |
| // | |
| // http://37signals.com/svn/posts/2407-device-scale-user-interface-elements-in-ios-mobile-safari | |
| // Copyright (c) 2010 37signals. | |
| // | |
| // Permission is hereby granted, free of charge, to any person obtaining a copy | |
| // of this software and associated documentation files (the "Software"), to deal | |
| // in the Software without restriction, including without limitation the rights | |
| // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| alias server='open http://localhost:8000 && python -m SimpleHTTPServer' |
| # Copy it to fnordmetric directory and run with | |
| # | |
| # bundle exec ruby -Ilib -I. populate.rb live | |
| # | |
| # to generate fake current traffic or | |
| # | |
| # bundle exec ruby -Ilib -I. populate.rb past | |
| # | |
| # to generate fake stats for last month. | |
| # |
Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
| var flatiron = require('flatiron'), | |
| app = flatiron.app; | |
| console.log('What\'s that in your hand? Look down,'); | |
| app.use(require('./tickets')); | |
| console.log('look up. I HAVE IT. It\'s ' + app.qty + ' TICKETS to ' + app.description + '!'); | |
| console.log('Look again.'); | |
| app.use(require('./diamonds')); |
| <?php | |
| /** | |
| * @file views-view-grid.tpl.php | |
| * Default simple view template to display a rows in a grid. | |
| * | |
| * - $rows contains a nested array of rows. Each row contains an array of | |
| * columns. | |
| * | |
| * @ingroup views_templates | |
| */ |
| <?php namespace App; | |
| use Illuminate\Database\Eloquent\Builder as BaseBuilder; | |
| class Builder extends BaseBuilder{ | |
| /** | |
| * Override getModels so it send attributes to the newInstance methods (in newExisting) | |
| */ | |
| public function getModels($columns = array('*')) |