PhpStorm now bundles WordPress coding style natively, starting from version 8.
- Go to
Project Settings>Code Style>PHP. - Select
Set From...(top right of window) >Predefined Style>WordPress.
No longer need to muck with this import! :)
| /* | |
| * | |
| * A simple S3 library written because the other implementation doesn't meet needs and is outdated. | |
| * | |
| * What this library is good for: | |
| * | |
| * ** Can send files any size (although S3 is currently limited at 5 gigs) | |
| * ** Streams files from disk to socket -- minimal memory footprint and very efficient | |
| * ** Uses sockets to support 100 Continue (especially usefull for large files) | |
| * - the body is only sent after amazon approves the signed header |
| framework 'Cocoa' | |
| class NSColor | |
| def toCGColor | |
| color_RGB = colorUsingColorSpaceName(NSCalibratedRGBColorSpace) | |
| ## approach #1 | |
| # components = Array.new(4){Pointer.new(:double)} | |
| # color_RGB.getRed(components[0], | |
| # green: components[1], | |
| # blue: components[2], |
| # | |
| # Initialize the stuff | |
| # | |
| # We build the status bar item menu | |
| def setupMenu | |
| menu = NSMenu.new | |
| menu.initWithTitle 'FooApp' | |
| mi = NSMenuItem.new | |
| mi.title = 'Hellow from MacRuby!' | |
| mi.action = 'sayHello:' |
| <?php | |
| /* | |
| Plugin Name: Enable Twitter oEmbed | |
| Description: Enables automatic embedding of twitter updates through oembed | |
| Author: Michael Simons | |
| Version: 1.0 | |
| Author URI: http://michael-simons.eu | |
| */ | |
| wp_oembed_add_provider('#https?://twitter.com/\#!/[a-z0-9_]{1,20}/status/\d+#i', 'https://api.twitter.com/1/statuses/oembed.json', true); | |
| ?> |
| #!/bin/sh | |
| ## this is a quick and dirty script to automagically install the latest chromium build on OSX 10.5 | |
| ## you can set this up as a nightly cron job, or run manually from the command line | |
| # USAGE: | |
| # save script to your home directory aka /Users/$USER/ | |
| # open up a command prompt (aka /Applications/Utilities/Terminal) | |
| # run manually from the command line whenever you want the most recent chromium build | |
| # $ sh get_latest_chromium.sh | |
| # start it as a nightly task (runs at 1am or edit the plist below) |
| #!/usr/bin/env ruby | |
| # This pre-commit hook will prevent any commit to forbidden branches | |
| # (by default, "staging" and "production"). | |
| # Put this file in your local repo, in the .git/hooks folder | |
| # and make sure it is executable. | |
| # The name of the file *must* be "pre-commit" for Git to pick it up. | |
| FORBIDDEN_BRANCHES = ["staging", "production"] |
| from urllib import quote_plus | |
| from lxml import etree | |
| def untruncate(s): | |
| q = s.strip(u' .\u2026') | |
| url = 'http://google.com/complete/search?output=toolbar&q=' + quote_plus(q.encode('latin-1')) | |
| root = etree.parse(url).getroot() | |
| return q + root[0][0].attrib['data'][len(q):] if len(root) else s | |
| def demo(): |
| // This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref | |
| <?php | |
| /** | |
| * WordPress Query Comprehensive Reference | |
| * Compiled by luetkemj - luetkemj.github.io | |
| * | |
| * CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters | |
| * Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php | |
| */ |