Skip to content

Instantly share code, notes, and snippets.

View Nightbr's full-sized avatar
🦎

Titouan B Nightbr

🦎
View GitHub Profile
@tuongaz
tuongaz / BaseModelManager.php
Created April 1, 2012 03:51
Symfony2 Model Manager
<?php
abstract class BaseModelManager {
protected $em;
protected $class;
protected $repository;
protected $container;
/**
* Constructor.
@Tocacar
Tocacar / gist:4337861
Created December 19, 2012 16:06
I need to create a custom DataSourceIterator so that I can pass a related collection's properties to the sonata admin bundle's exportAction (I think this is the only way to achieve the export of one-to-many values, I may be wrong). I have traced backwards how my admin class is currently generating a DataSourceIterator (I think) - see below. Pres…
// vendor/sonata-project/admin-bundle/Sonata/AdminBundle/Admin/Admin.php
/**
* @return
*/
public function getDataSourceIterator()
{
$datagrid = $this->getDatagrid();
$datagrid->buildPager();
@jaicab
jaicab / responsive-video.css
Last active July 29, 2023 02:52
Pure CSS solution for embed videos with an aspect ratio of 16:9
.video-container {
position: relative;
padding-bottom: 56.25%; /*16:9*/
padding-top: 30px;
height: 0;
overflow: hidden;
}
.video-container iframe,
.video-container object,

It seems that it does not matter what timezone is on the server as long as you have the time set right for the current timezone, know the timezone of the datetime columns that you store, and are aware of the issues with daylight savings time.

On the other hand if you have control of the timezones of the servers you work with then you can have everything set to UTC internally and never worry about timezones and DST.

Here are some notes I collected of how to work with timezones as a form of cheatsheet for myself and others which might influence what timezone the person will choose for his/her server and how he/she will store date and time.

MySQL Timezone Cheatsheet

@ythecombinator
ythecombinator / add_disqus_hexo.md
Created May 27, 2015 23:59
Simple tip for adding "Disqus" comments for Hexo.

In the footer of your theme (something like footer.ejs) you should add Disqus script:

<% if (config.disqus_shortname){ %>
<script>
  var disqus_shortname = '<%= config.disqus_shortname %>';
  <% if (page.permalink){ %>
  var disqus_url = '<%= config.url +"/"+ page.path %>';
  <% } %>
 (function(){
@ankurk91
ankurk91 / install-node-js.sh
Last active April 10, 2024 13:53
Install node-js, npm and yarn on Ubuntu/Mac using nvm
#!/bin/sh
# Install node and npm via nvm - https://github.com/nvm-sh/nvm
# Run this script like - bash script-name.sh
# Define versions
INSTALL_NODE_VER=20
INSTALL_NVM_VER=0.39.7
@alexander-schranz
alexander-schranz / SuluExtendController.php
Last active December 29, 2021 15:19
Custom sulu controller which load some data from a service
<?php
namespace App\Controller\Website;
use Sulu\Bundle\WebsiteBundle\Controller\WebsiteController;
use Sulu\Component\Content\Compat\StructureInterface;
/**
* Controller which needs a custom service to add data to render twig template.
*/
@Brainiarc7
Brainiarc7 / refind-setup.md
Last active July 18, 2024 14:44
Setting up rEFInd on Ubuntu 16.04 LTS for multi-boot purposes with secure boot enabled.

Deploying rEFInd on Ubuntu 16.04 LTS with secure boot enabled

Hello guys,

For these dual-booting Ubuntu 16.04 with an alternate operating system in UEFI boot mode, it may often be necessary to use a third-party boot manager such as rEFInd, as it's significantly superior to grub2's on UEFI-capable systems.

This write-up assumes that:

(a). The user is running a current Ubuntu 16.04LTS operating system installation (preferably on a dual-boot system)

@alborq
alborq / DocumentationNormalizer.php
Last active July 21, 2020 11:14
API-Platform Use JWT Token to auth, Add JWT in documentation | Api-platofrm, JWT, PHP, Documentation, Security, Swagger
<?php
namespace AppBundle\Documentation;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
/**
* Class DocumentationNormalizer
* @package AppBundle\Documentation