Skip to content

Instantly share code, notes, and snippets.

View St0iK's full-sized avatar
☘️
🇬🇷

Dimitris Stoikidis St0iK

☘️
🇬🇷
View GitHub Profile
@ankurk91
ankurk91 / mac-apps.md
Last active March 15, 2024 05:14
Mac OS 10.15 Apps and configs

macOS Apps

⚠️ No longer maintained! ⚠️

# Install x-code command line tools 
xcode-select --install

# Install homebrew iteself
@weaverryan
weaverryan / FooController.php
Last active April 18, 2017 13:58
Autowiring controller args
<?php
namespace AppBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Psr\Log\LoggerInterface;
/**
* This class is now a service, so you can use normal __construct DI if you want!
*/

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?

@mizner
mizner / scotchboxphp7.txt
Last active August 23, 2021 10:45
Scotchbox PHP 7
List of PHP 7 Packages: https://launchpad.net/ubuntu/+source/php7.0
Disclaimer: I get unreliable results when I don't run these commands seperately and in order.
vagrant ssh
sudo apt-get update
sudo add-apt-repository ppa:ondrej/php
sudo apt-get install php7.0
sudo apt-get update
@jesstelford
jesstelford / event-loop.md
Last active April 28, 2024 06:50
What is the JS Event Loop and Call Stack?

Regular Event Loop

This shows the execution order given JavaScript's Call Stack, Event Loop, and any asynchronous APIs provided in the JS execution environment (in this example; Web APIs in a Browser environment)


Given the code

@cedricblondeau
cedricblondeau / ImageChooser.php
Created January 14, 2016 02:40
Image Chooser for Magento2 widgets
<?php
namespace Vendor\Module\Block\Adminhtml\Widget;
class ImageChooser extends \Magento\Backend\Block\Template
{
/**
* @var \Magento\Framework\Data\Form\Element\Factory
*/
protected $_elementFactory;
var App = {
myProperty : 'someValue',
jqueryVar1 : $('.someClass'),
jqueryVar2 : $('.someOtherClass'),
jqueryVar3 : $('#id'),
myConfig:{
useCaching:true,
language: 'en'
},
@Graceas
Graceas / FormErrorsSerializer.php
Created September 10, 2013 06:26
Symfony 2 Form Error Serializer. May be used for AJAX form validation. Allows tree and flat array styles for errors.
class FormErrorsSerializer {
public function serializeFormErrors(\Symfony\Component\Form\Form $form, $flat_array = false, $add_form_name = false, $glue_keys = '_')
{
$errors = array();
$errors['global'] = array();
$errors['fields'] = array();
foreach ($form->getErrors() as $error) {
$errors['global'][] = $error->getMessage();
@kalenjordan
kalenjordan / Batched Iterator for Magento collections
Last active May 9, 2022 12:25
Batched iterator for Magento collections
// This is how you would use it. Pass in your collection
// along with an individual callback as well as a batch callback
Mage::getSingleton('stcore/resource_iterator_batched')->walk(
$collection,
array($this, 'batchIndividual'),
array($this, 'batchAfter'),
self::BATCH_SIZE
);
public function batchIndividual($model)
<?php
/**
* Implements hook_form_alter().
*
* Redirects user logins to the front page.
*/
function HOOK_form_user_login_alter(&$form, &$form_state) {
$form['#action'] = url('user', array('query' => array('destination' => '<front>')));
}