Skip to content

Instantly share code, notes, and snippets.

View imkingdavid's full-sized avatar

David King imkingdavid

View GitHub Profile
@imkingdavid
imkingdavid / currency_format.php
Created November 19, 2013 21:29
Twig extension method to add a filter that formats currency similarly to the number_format filter, but with a few changes.
<?php
/**
* Basically a currency replacement for number_format
*
* Big differences are
*
* @param int $amount
* @param int $decimal Number of decimal places
* @param string $decimalPoint What to use as the decimal point
* @param string
@imkingdavid
imkingdavid / Extension.php
Created November 19, 2013 20:46
A simple Twig Filter extension for Symfony2 that converts a JSON Date object into a timestamp that can be used in the PHP date() function.
<?php
namespace Acme\DemoBundle\Twig;
use Twig_Extension;
use Twig_Filter_Method;
class AcmeExtension extends Twig_Extension
{
public function getFilters()
{
<imkingdavid> what's the preferred way of making sure another extension hasn't already loaded jquery ui before I load it?
<nickvergessen> there is a function for it?
<imkingdavid> is that a question or are you telling me there is
<nickvergessen> <script type="text/javascript">window.jQuery || document.
<nickvergessen> similar to this
<nickvergessen> i think there should be
<nickvergessen> if (jQuery.ui) {
<nickvergessen> so try
<nickvergessen> windows.jQuery.ui || ....
<imkingdavid> i have this line: <!-- INCLUDEJS jquery.ui.js -->
<imkingdavid> EX|away: i think one of the main reasons for install/enable/disable/uninstall was to rename "purge". But if we have "uninstall" it doesn't make sense to not have "install"
<EX|away> uninstall makes sense to me without having install
<EX|away> this should be in an RFC to have others who are not strictly developers comment on
<imkingdavid> alright, i'll make one
<-> EX|away is now known as EXreaction
<imkingdavid> https://area51.phpbb.com/phpBB/viewtopic.php?f=108&t=44881
<EXreaction> ty
<naderman> replied
<naderman> I disagree with both changes
<nickvergessen> will reply i disagree with anderman in both
<bantu> are you talking about travis tests?
<bantu> imkingdavid: functional tests are using nginx
<bantu> so anything you do in .htaccess won't work
<imkingdavid> i'm not using rewriting for the tests
<imkingdavid> app.php/foo/bar works without rewriting
<bantu> it does
<bantu> it requires PATH_INFO instead
<bantu> which nginx doesn't have by default
<imkingdavid> i'm using symfony which has its own method of determining path info when it's empty.
<imkingdavid> but it could be not working
Fatal error: Uncaught exception 'OAuth\Common\Http\Exception\TokenResponseException' with message 'Failed to request resource.' in C:\xampp\htdocs\phpbb\oauth\vendor\lusitanian\oauth\src\OAuth\Common\Http\Client\StreamClient.php:75 Stack trace: #0 C:\xampp\htdocs\phpbb\oauth\vendor\lusitanian\oauth\src\OAuth\OAuth2\Service\AbstractService.php(97): OAuth\Common\Http\Client\StreamClient->retrieveResponse(Object(OAuth\Common\Http\Uri\Uri), Array, Array) #1 C:\xampp\htdocs\phpbb\oauth\phpbb\auth\provider\oauth\service\google.php(85): OAuth\OAuth2\Service\AbstractService->requestAccessToken('4/kk4UZxeAv0QwG...') #2 C:\xampp\htdocs\phpbb\oauth\phpbb\auth\provider\oauth\oauth.php(159): phpbb_auth_provider_oauth_service_google->perform_auth_login() #3 C:\xampp\htdocs\phpbb\oauth\phpbb\auth\auth.php(937): phpbb_auth_provider_oauth->login('', '') #4 C:\xampp\htdocs\phpbb\oauth\includes\functions.php(3267): phpbb_auth->login('', '', false, 1, 0) #5 C:\xampp\htdocs\phpbb\oauth\ucp.php(80): login_box('index.php') #6 {main
<!-- IF S_JQUERY_FALLBACK --><script type="text/javascript">window.jQuery || document.write(unescape('%3Cscript src="{T_ASSETS_PATH}/javascript/jquery.js?assets_version={T_ASSETS_VERSION}" type="text/javascript"%3E%3C/script%3E'));</script><!-- ENDIF -->
<!-- INCLUDEJS forum_fn.js -->
<!-- INCLUDEJS {T_ASSETS_PATH}/javascript/core.js -->
<!-- INCLUDEJS ajax.js -->
Becomes:
<script type="text/javascript" src="../assets/javascript/jquery.js?assets_version=1"></script>
@imkingdavid
imkingdavid / gist:4252662
Created December 10, 2012 19:16
remaining stuff for migrations as of Dec 10, 2012 @ 1:10PM EST
<naderman> state needs to be kept properly, database_update.php needs to be rewritten to run the migrations, rollbacks need to be implemented
<naderman> extensions stuff needs to be integrated with it
<naderman> proper error handling needs to be added
<naderman> and auto rollback for partially applied migrations on error
<naderman> and we need to very thorougly test that our conversion of databse_update contents to migrations still works correctly
@imkingdavid
imkingdavid / gist:3715918
Created September 13, 2012 17:16
phpBB Development Meeting #4 IRC Log
[13:00:45] <imkingdavid> so short meeting today I guess
[13:00:47] <imkingdavid> two items
[13:00:48] <brunoais> here
[13:00:50] <naderman> not too many people said they can make it anyway
[13:00:57] <imkingdavid> yeah
[13:01:15] <imkingdavid> first item: status of migrations and template events
[13:01:39] <naderman> on template events you made a post about how it should work
[13:01:44] <naderman> but the key bit there is actually missing
[13:01:52] <naderman> it's not just piriority of files within an extension
[13:02:08] <naderman> but it's actually important to consider what happens when multiple extensions provide the same file
@imkingdavid
imkingdavid / gist:3379984
Created August 17, 2012 15:37
phpBB Development Meeting #3 - 8/17/2012
[11:00:11] <imkingdavid> alright, let's get this started
[11:00:15] <imkingdavid> ping: unknownbliss
[11:00:27] <imkingdavid> first item is 'Attachment Improvements needs a final review and dependencies need to be reviewed and merged."
[11:00:35] <unknownbliss> imkingdavid: thanks
[11:00:59] <imkingdavid> bantu was the one that brought that up, I think
[11:01:33] <imkingdavid> Fyorl: if you're around, do you have anything to say about it?
[11:01:45] <bantu> Dependency is https://github.com/phpbb/phpbb3/pull/881
[11:01:52] <bantu> I don't know what to do with that.
[11:02:07] <naderman> I guess I need to do that?
[11:02:09] <bantu> Plupload / Attachment Improvements is https://github.com/phpbb/phpbb3/pull/833