Skip to content

Instantly share code, notes, and snippets.

View aleksblendwerk's full-sized avatar

Aleks Seltenreich aleksblendwerk

View GitHub Profile
C:\Users\Luis>ruby -v
ruby 1.9.2p0 (2010-08-18) [i386-mingw32]
C:\Users\Luis>gem install mysql2 --platform=ruby -- --with-mysql-include=C:\mysql-5.1.51-win32\include --with-mysql-lib=C:\mysql-5.1.51-win32\lib\opt
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
Successfully installed mysql2-0.2.5
1 gem installed
C:\Users\Luis>irb
@ndarville
ndarville / examples.mdown
Last active December 9, 2019 11:32
“We’ve Been Hacked” Boilerplate Announcement

How Companies Communicated Being Hacked

It’s probably a pretty bad idea to have your site go down, when people are supposed to read the blog post explaining the hack.

Notice how another site reporting the hack received more attention than Twitter’s own announcement. Why was that?

@Chaser324
Chaser324 / GitHub-Forking.md
Last active July 22, 2024 14:45
GitHub Standard Fork & Pull Request Workflow

Whether you're trying to give back to the open source community or collaborating on your own projects, knowing how to properly fork and generate pull requests is essential. Unfortunately, it's quite easy to make mistakes or not know what you should do when you're initially learning the process. I know that I certainly had considerable initial trouble with it, and I found a lot of the information on GitHub and around the internet to be rather piecemeal and incomplete - part of the process described here, another there, common hangups in a different place, and so on.

In an attempt to coallate this information for myself and others, this short tutorial is what I've found to be fairly standard procedure for creating a fork, doing your work, issuing a pull request, and merging that pull request back into the original project.

Creating a Fork

Just head over to the GitHub page and click the "Fork" button. It's just that simple. Once you've done that, you can use your favorite git client to clone your repo or j

What's the difference between cascade="remove" and orphanRemoval=true in Doctrine 2

TLDR: The cascade={"remove"} is like a "software" onDelete="CASCADE", and will remove objects from the database only when an explicit call to $em->remove() occurs. Thus, it could result in more than one object being deleted. orphanRemoval can remove objects from the database even if there was no explicit call to ->remove().

I answered this question a few times to different people so I will try to sum things up in this Gist.

Let's take two entities A and B as an example. I will use a OneToOne relationship in this example but it works exactly the same with OneToMany relationships.

class A
@guiwoda
guiwoda / AR_Cache_Repository.php
Last active February 25, 2023 21:11
AR (Eloquent) vs DM (Doctrine) gist
<?php
namespace App\ActiveRecord;
class PostRepository
{
private $cache;
public function __construct(Cache $cache)
{
// Any set() / get() cache implementation.
const puppeteer = require("puppeteer");
let waitTime = 5 * 1000;
async function testAjax() {
const url = "https://www.notion.so/Test-page-all-c969c9455d7c4dd79c7f860f3ace6429"
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.setRequestInterception(true);
// those we don't want to log because they are not important