Skip to content

Instantly share code, notes, and snippets.

View fabsor's full-sized avatar

Fabian Sörqvist fabsor

  • Leanlab
  • Göteborg
View GitHub Profile
@fabsor
fabsor / stackbattle.md
Last active April 6, 2023 06:48
Stack battle

Stack battle

Feature Django Laravel Winner Comment
Authentication In core In Core Laravel Multiple starter kits available with ready-made templates for login, pw reset etc. Single sign on/two factor auth available.
Authorization In Core In Core Django Django has a built-in permissions system. Laravel has many concepts. Gates, Policies, etc. but requires more code. There's a popular permissions package that adds capabilities to laravel.
Templating system In core In Core Laravel Laravel has the concept of components which is easier to wrap your head around then extending the django templating system.
ORM In core In core Django The django ORM model definition is a lot easier to reason about, and offers automatic migrations. The Laravel query builder is a bit easeier and more SQL-like, but the ORM is really inefficient compared to Django.
Performance Ok Bad Django Laravel requires a lot more work to b

Keybase proof

I hereby claim:

  • I am fabsor on github.
  • I am fabsor (https://keybase.io/fabsor) on keybase.
  • I have a public key whose fingerprint is 885F 2DA0 7342 32AA 7E51 1F71 67E6 2F34 7B2D 2663

To claim this, I am signing this object:

@fabsor
fabsor / gist:6fb128d9710dd728a68a2d41ed2707e8
Created August 19, 2017 11:29
drunken python penguin
#! /bin/bash
# I just put my virtualenv shit in a folder right under
# my user account. You probably want to do something else,
# because you probably think I'm wrong for some reason.
# Go ahead. Change it all you want. See if I care. Fucker.
VIRTUALENV_HOME='~/.virtualenvs'
# You're probably a fucking hipster, so I guess you're using
# zsh. Change this to .bashrc if you're an old fucking dinosaur.
[
{
"description": "Put them in the pan",
"title": "Delicious pancackes"
},
{
"description": "Put berries on a cake",
"title": "Epic strawberry cake"
},
{
@fabsor
fabsor / gist:c7c925c80b06ec92a52a
Created November 24, 2014 04:56
new references dialog patch
diff --git a/js/references-dialog.js b/js/references-dialog.js
index 0c23b31..fbc5659 100644
--- a/js/references-dialog.js
+++ b/js/references-dialog.js
@@ -1,52 +1,153 @@
(function ($) {
-
var $window = $(window);
-
Drupal.behaviors.referencesDialog = {
@fabsor
fabsor / gist:b96095c440d1982c5f92
Last active August 29, 2015 14:04
combined patches for media
diff --git a/js/media.popups.js b/js/media.popups.js
index 46af675..9b2d634 100644
--- a/js/media.popups.js
+++ b/js/media.popups.js
@@ -181,6 +181,7 @@ Drupal.media.popups.mediaStyleSelector = function (mediaFile, onSelect, options)
dialogOptions.buttons[ok] = function () {
var formattedMedia = this.contentWindow.Drupal.media.formatForm.getFormattedMedia();
+ formattedMedia.options = $.extend({}, mediaFile.attributes, formattedMedia.options);
if (!formattedMedia) {
@fabsor
fabsor / gist:0ad96f5b051036199300
Last active August 29, 2015 14:04
Dynamic links and choosable add links for references dialog
diff --git a/js/references-dialog.js b/js/references-dialog.js
index 0c23b31..ac88071 100644
--- a/js/references-dialog.js
+++ b/js/references-dialog.js
@@ -1,52 +1,152 @@
(function ($) {
-
var $window = $(window);
-
Drupal.behaviors.referencesDialog = {
@fabsor
fabsor / gist:27b8de2ce2b3785e6330
Last active August 29, 2015 14:04
patch for refererences dialog edit
diff --git a/js/references-dialog.js b/js/references-dialog.js
index 0c23b31..23caa22 100644
--- a/js/references-dialog.js
+++ b/js/references-dialog.js
@@ -1,52 +1,123 @@
(function ($) {
-
var $window = $(window);
-
Drupal.behaviors.referencesDialog = {
@fabsor
fabsor / gist:f09611565be9f7ca7840
Last active August 29, 2015 14:02
fix admin language
diff --git a/admin_language.module b/admin_language.module
index c6c10dd..89df82e 100644
--- a/admin_language.module
+++ b/admin_language.module
@@ -71,7 +71,10 @@ function admin_language_menu_link_alter(&$item) {
*/
function admin_language_translated_menu_link_alter(&$item, $map) {
if ('management' == $item['menu_name'] || 'user/logout' == $item['link_path']) {
- if (variable_get('admin_language_translate_admin_menu', 0)) {
+ global $language, $_admin_language;
@fabsor
fabsor / framework_comparison.md
Last active August 29, 2015 14:00
Framework comparison

Konzilo calendar web service framework comparison

Background

When we set out to create Konzilo we had a few ideas in mind:

  • The frontend was going to be completely separate from the backend.
  • The backend should be in the form of a REST web service and should do as little as possible.
  • The data model should be flexible but we still need to ensure some form of consistency.

What we didn't know at the time was that the data model that we set out to build would turn out to be highly relational in nature. We thought of each article in the system as one document, and that document could be big and possibly consist of many sub documents. This worked out great in the beginning, but as we moved forward with the application architecture we found difficulties with this approach.