| ⌘T | go to file |
| ⌘⌃P | go to project |
| ⌘R | go to methods |
| ⌃G | go to line |
| ⌘KB | toggle side bar |
| ⌘⇧P | command prompt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $db = mysql_connect('localhost', 'db_user', 'db_password'); | |
| mysql_select_db('blog'); | |
| $sql = "SELECT * FROM wp_posts WHERE post_status IN ('publish', 'private') AND post_type = 'post'"; | |
| $r = mysql_query($sql); | |
| get_posts($r); | |
| // do drafts separately in order to keep them from messing with published posts' URLs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- copy this to YOUR_THEME.tmTheme--> | |
| <dict> | |
| <key>name</key> | |
| <string>diff: deleted</string> | |
| <key>scope</key> | |
| <string>markup.deleted</string> | |
| <key>settings</key> | |
| <dict> | |
| <key>background</key> | |
| <string>#EAE3CA</string> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --colour | |
| -I app |
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # encoding: utf-8 | |
| module Nanoc3::Filters | |
| class AbsolutizePaths < Nanoc3::Filter | |
| identifier :absolutize_paths | |
| require 'nanoc3/helpers/link_to' | |
| include Nanoc3::Helpers::LinkTo | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var oldSync = Backbone.sync; | |
| Backbone.sync = function(method, model, options){ | |
| options.beforeSend = function(xhr){ | |
| xhr.setRequestHeader('X-CSRFToken', CSRF_TOKEN); | |
| }; | |
| return oldSync(method, model, options); | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require "logger" | |
| configure do | |
| LOG = Logger.new(STDOUT) | |
| LOG.level = Logger.const_get ENV['LOG_LEVEL'] || 'DEBUG' | |
| LOG.info 'I am logging something.' | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # lib/api/presenters/detailed_post.rb | |
| module API | |
| module Presenters | |
| class DetailedPost | |
| include ActiveModel::Serializers::JSON | |
| include ActiveModel::Serializers::Xml | |
| attr_accessor :post | |
| delegate :attributes, :to => :post |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # == Active Model North American Telephone Number Validator | |
| # http://en.wikipedia.org/wiki/North_American_Numbering_Plan#Current_system | |
| # [Author] Roger Rohrbach (roger@ecstatic.com) | |
| class NanpValidator < ActiveModel::EachValidator | |
| def self.matcher(require_area_code) # :nodoc: | |
| %r{ | |
| (?<country_code> \+1 ){0} | |
| (?<trunk_prefix> 1 ){0} | |
| (?<delimiter> ([-\.]|\ +) ){0} |