Skip to content

Instantly share code, notes, and snippets.

Slack Code of Conduct

Welcome to the Cardiff Dev Slack Code of Conduct.

This is a place to ask questions, work through any development challenges, and share ideas and best practices. The following suggestions and guidelines are intended to make the community easier and more enjoyable to use.

  1. Getting Started
  2. A few details
  3. Code of Conduct
@Bendihossan
Bendihossan / bootbox.js
Last active August 29, 2015 14:05
Broken bootbox.js code
/**
* bootbox.js [v4.3.0]
*
* http://bootboxjs.com/license.txt
*/
// @see https://github.com/makeusabrew/bootbox/issues/180
// @see https://github.com/makeusabrew/bootbox/issues/186
(function (root, factory) {
@Bendihossan
Bendihossan / twitter.php
Created April 13, 2013 16:06
Get tweets from twitter in less than 20 lines of PHP.
<?php
define('CONSUMER_KEY', 'your-key');
define('CONSUMER_SECRET', 'your-key');
define('TWITTER_TOKEN', 'your-key');
define('TWITTER_TOKEN_SECRET', 'your-key');
$oauth = new OAuth(CONSUMER_KEY, CONSUMER_SECRET, OAUTH_SIG_METHOD_HMACSHA1, OAUTH_AUTH_TYPE_URI);
$oauth->setToken(TWITTER_TOKEN, TWITTER_TOKEN_SECRET);
$oauth->fetch('https://api.twitter.com/1.1/statuses/home_timeline.json?count=10');
@Bendihossan
Bendihossan / ConfigurationBuilder.php
Last active December 15, 2015 17:49
Honour assets_base_urls if used
<?php
/**
* Get the RequireJS configuration options.
* @return array
*/
public function getConfiguration()
{
if ($this->useControllerForAssets && $this->container->isScopeActive('request')) {
$baseUrl = $this->container->get('request')->getBaseUrl();
$baseUrl = \ltrim($baseUrl, '/');
@Bendihossan
Bendihossan / phpextensions.md
Last active June 12, 2018 21:30
I'm looking for a list of PHP extensions that are popular/essential for development; specifically ones not included in standard distributions.

Popular/Essential PHP Extensions

  • xdebug
  • INTL
  • gettext
  • PDO_*
  • APC
  • memcached
<?php
// ...
public function buildForm(FormBuilderInterface $builder, array $options)
{
parent::buildForm($builder, $options);
$builder->add(
'email',
'email',
array(
<?php
/**
* ProTalk
*
* Copyright (c) 2012-2013, ProTalk
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
jekyll serve
WARNING: Could not read configuration. Using defaults (and options).
No such file or directory - /opt/local/apache2/htdocs/jekyll/_config.yml
Building site: /opt/local/apache2/htdocs/jekyll -> serve
YAML Exception reading broken_front_matter2.erb: syntax error on line 2, col 0: `'
YAML Exception reading exploit_front_matter.erb: invalid subclass
Liquid Exception: No such file or directory - /opt/local/apache2/htdocs/jekyll/_includes in 2008-12-13-include.markdown
/opt/local/lib/ruby/gems/1.8/gems/jekyll-0.12.0/bin/../lib/jekyll/tags/include.rb:20:in `chdir'
/opt/local/lib/ruby/gems/1.8/gems/jekyll-0.12.0/bin/../lib/jekyll/tags/include.rb:20:in `render'
/opt/local/lib/ruby/gems/1.8/gems/liquid-2.4.1/lib/liquid/block.rb:94:in `render_all'
PHP Fatal error: Declaration of JMS\\DebuggingBundle\\Kernel\\NullProfilerStorage::find() must be compatible with that of Symfony\\Component\\HttpKernel\\Profiler\\ProfilerStorageInterface::find() in /opt/local/apache2/htdocs/symfony-standard/vendor/jms/debugging-bundle/JMS/DebuggingBundle/Kernel/NullProfilerStorage.php on line 25
@Bendihossan
Bendihossan / ContentController.php
Created December 19, 2012 14:34
AnnotationException: [Semantical Error] The annotation "@fos\RestBundle\Controller\Annotations\View" in method MyProject\Bundle\ContentBundle\Controller\ContentController::indexAction() does not exist, or could not be auto-loaded.
<?php
...
use FOS\RestBundle\Controller\Annotations\View;
...
/**
* Returns all content
*
* [GET] /{_locale}/content
* @View()
*