Skip to content

Instantly share code, notes, and snippets.

View delineas's full-sized avatar
🚀
Launching...

Daniel Primo delineas

🚀
Launching...
View GitHub Profile
@rossriley
rossriley / CSVImportCommand.php
Created July 25, 2016 10:38
Import Content to Bolt from CSV File
<?php
namespace Mysite\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputOption;
use Bolt\Application;
@AlexSkrypnyk
AlexSkrypnyk / mymodule.css
Last active April 17, 2024 08:37
Drupal 'add more' and 'remove single' AJAX buttons on multi value custom field using FormAPI
input.form-submit.button-small {
padding: 4px 8px;
font-weight: bold;
}
.container-inline input.form-submit.button-small + .ajax-progress.ajax-progress-throbber .throbber {
position: absolute;
left: 19px;
margin-top: 7px;
}
@webdevilopers
webdevilopers / ElectricalEquipmentAdmin.php
Created January 11, 2016 09:16
Using createQuery with LEFT JOIN and PARTIAL to improve performance on Sonata Admin listView and prevent extra queries
<?php
public function createQuery($context = 'list')
{
$query = parent::createQuery($context);
$query->addSelect(
'PARTIAL ' . $query->getRootAlias() . '.{id, name, description, serialNumber, approvalNumber, ' .
'invoiceDate, createdAt}',
'PARTIAL pc.{id, name}',
@itiswicked
itiswicked / calendar.md
Last active September 29, 2021 20:55
Calendar User Stories

Calendar App

Overview

A one page calendar app

Initial Proposal

I initially proposed this as an application for managing items needed for the events. Here is the original proposal:

@dmouse
dmouse / Dockerfile
Last active June 2, 2022 20:52
Run Firefox or Google Chrome into a Docker container | based on http://fabiorehm.com/blog/2014/09/11/running-gui-apps-with-docker/
FROM ubuntu:14.04
# Replace 1000 with your user / group id
RUN export uid=1000 gid=1000 && \
mkdir -p /home/developer && \
echo "developer:x:${uid}:${gid}:Developer,,,:/home/developer:/bin/bash" >> /etc/passwd && \
echo "developer:x:${uid}:" >> /etc/group && \
echo "developer ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/developer && \
chmod 0440 /etc/sudoers.d/developer && \
chown ${uid}:${gid} -R /home/developer
@ajaxray
ajaxray / symfony2-bundle-config.md
Last active February 7, 2019 12:02
Symfony2 - Getting Bundle configuration from app/config/config.yml as a separated config block

APPROACH 1: Getting it as a parameter

With an extension (more on extensions here) you can keep this easily "separated" into different blocks in the config.yml and then inject that as a parameter gettable from the controller.

Inside your Extension class inside the DependencyInjection directory write this:

class MyNiceProjectExtension extends Extension
{
 public function load( array $configs, ContainerBuilder $container )
@helios-ag
helios-ag / gist:2abd77f3d6e02d0ea8ab
Created June 9, 2015 04:51
Tinymce/Elfinder configuration
stfalcon_tinymce:
include_jquery: true
tinymce_jquery: true
selector: ".tinymce"
theme:
simple: ~
advanced:
plugins:
- "advlist autolink lists link image charmap print preview hr anchor pagebreak"
- "searchreplace wordcount visualblocks visualchars code fullscreen"
@furkanmustafa
furkanmustafa / SimpleICS.php
Last active May 16, 2023 12:42
Simple ICS Generation class for PHP
<?php /*
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@tjamps
tjamps / README.md
Last active February 29, 2024 14:57
Basic RESTful API with Symfony 2 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle

Basic RESTful API with Symfony 2 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle

The API we are creating in this gist will follow these rules :

  • The API only returns JSON responses
  • All API routes require authentication
  • Authentication is handled via OAuth2 with password Grant Type only (no need for Authorization pages and such).
  • API versioning is managed via a subdomain (e.g. v1.api.example.com)

The API will be written in PHP with the Symfony 2 framework. The following SF2 bundles are used :

@domenic
domenic / 0-github-actions.md
Last active April 8, 2024 23:35
Auto-deploying built products to gh-pages with Travis

Auto-deploying built products to gh-pages with GitHub Actions

This is a set up for projects which want to check in only their source files, but have their gh-pages branch automatically updated with some compiled output every time they push.

A file below this one contains the steps for doing this with Travis CI. However, these days I recommend GitHub Actions, for the following reasons:

  • It is much easier and requires less steps, because you are already authenticated with GitHub, so you don't need to share secret keys across services like you do when coordinate Travis CI and GitHub.
  • It is free, with no quotas.
  • Anecdotally, builds are much faster with GitHub Actions than with Travis CI, especially in terms of time spent waiting for a builder.