Skip to content

Instantly share code, notes, and snippets.

View Pictor13's full-sized avatar
🤹‍♂️
Juggling with curiosity

Igor Pellegrini Pictor13

🤹‍♂️
Juggling with curiosity
  • BerlinOnline Stadtportal GmbH & Co. KG
  • Berlin
View GitHub Profile
@GiacomoP
GiacomoP / app.js
Last active September 2, 2019 12:33
M5S Rousseau - Admin Frontend app
(function(e) {
function t(t) {
for (var n, s, r = t[0], l = t[1], d = t[2], c = 0, m = []; c < r.length; c++) s = r[c], a[s] && m.push(a[s][0]), a[s] = 0;
for (n in l) Object.prototype.hasOwnProperty.call(l, n) && (e[n] = l[n]);
u && u(t);
while (m.length) m.shift()();
return o.push.apply(o, d || []), i()
}
function i() {
@rponte
rponte / EntityManager_persist_vs_merge.md
Last active April 30, 2020 07:18
difference between entityManager.persist() and entityManager.merge()

QUESTION:

EntityManager.merge() can insert new objects and update existing ones.

Why would one want to use persist() (which can only create new objects)?

ANSWER:

Either way will add an entity to a PersistenceContext, the difference is in what you do with the entity afterwards.

@a-r-m-i-n
a-r-m-i-n / Easy Admin Bundle ConfigPass.md
Last active May 27, 2020 13:11
This document describes the process of Symfony's Easy Admin Bundle, to process the given YAML configuration, with registered **ConfigPass** classes.

Easy Admin Bundle ConfigPass

This document describes the process of Symfony's Easy Admin Bundle, to process the given YAML configuration, with registered ConfigPass classes.

The problem

Those ConfigPasses are collections of private methods, which have e.g. action names hardcoded, so you can't reuse the "config auto-magic" for your new actions.

@krisrybak
krisrybak / gist:ba7a9da1b80be6c913c9
Last active July 28, 2020 15:11
Symfony Annotations highlights for Sublime3

Please make sure you use Sublime 3 first:

  • From the Sublime Tex Menu choose option About and make sure build is higher that 3xxx
  • Navigate to your Sublime text packages directory: Sublime Text Menu > Preferences > Browse Packages...
  • Copy PHP folder form Cache into Packages folder
  • Locate PHP.tmLanguage file insde PHP folder and open in for edit:
  • Inside yuor PHP.tmLanguage find: <key>php_doc</key> node and update the language file by adding the following snippet under the php_doc's patterns array:
    <dict>
@marcaube
marcaube / entities-domain-and-models.md
Last active February 11, 2021 10:04
On Domain objects and code organization

A few days – or was it weeks – ago, I answered hastily to a question on the Symfony2 Google Group. The question is simple but the answer is not : How do your organise your code in a Symfony project?

I've had some time to think about it and wanted to elaborate on the subject. Writing makes me think, and thinking is good.

Everyone has their own way to do this. Some organize their code in a way that makes them faster – like in the RAD edition. Some others take the time and put the emphasis on making things isolated, modular and re-usable. Most of us fall somewhere in the middle, still trying to find the structure that suits us, our workflow or our organization the most.

My original answer to the question was to keep the domain logic separate from the bundle code, i.e. place it in a re-usable library. The reason is that your business logic should be encapsulated into models, outside of persistance concerns, logging and al

@ace-dent
ace-dent / TODAY service
Created April 3, 2015 22:19
Insert today's date in Mac OS X. Add as a Service via Automator using AppleScript, to create a Shortcut.
on run
# TODAY - Returns today's date!
# Create your own Service, to avoid 3rd Party software (WordService, etc.)
# In Automator:
# > Service receives 'no input' in 'any application'
# > Output replaces selected text
# Add Shortcut (e.g. Ctrl+Cmd+T - it's hard to find a free shortcut!):
# > Preferences > Keyboard > Keyboard Shortcuts > Services
# When setting up Keyboard Shortcut, *exit* the target app before testing. (It seems shortcuts are only refreshed when app is launched)
# Adjust 'Short' Date format
@binarymax
binarymax / module.exports.js
Last active May 5, 2021 01:06
The most basic module.exports hackery polyfill for browser. Adds lots of stuff to the global scope.
;(function(global){
global.module = {};
global.require = function(){};
Object.defineProperty(global.module,'exports',{
set:function(m) {
if (typeof m === 'function') {
var str = m.toString();
var name = str.substring(9,str.indexOf('(')).replace(/\s+/,'');
global[name] = m;
} else if (typeof m === 'object') {
class Period {
constructor(year, month) {
this.year = year;
this.month = month;
}
next() {
return this.month + 1 > 11
? new Period(this.year + 1, 0)
: new Period(this.year, this.month + 1)
@jeyj0
jeyj0 / haskell-crash-course.org
Created September 7, 2020 17:27
Haskell Crash Course

Haskell Crash-Course

Hello, Haskell!

putStrLn

putStrLn "Hello, Haskell!"
@DominicBreuker
DominicBreuker / iptables.md
Last active October 14, 2021 17:47
iptables firewall

iptables cheat sheet

Concepts

iptables defines tables, which group features:

  • filter: use it to filter traffic
  • nat: use it to implement NAT
  • raw: use it to define which connections iptables should track (stateful firewall)
  • mangle: use it to change some fields in packets (e.g., TTL)
  • security: use it to define access control