Skip to content

Instantly share code, notes, and snippets.

View carld's full-sized avatar
🔜

Carl carld

🔜
View GitHub Profile
<?xml version="1.0" encoding="UTF-8"?>
<csv-inputs xmlns="http://axelor.com/xml/ns/data-import"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://axelor.com/xml/ns/data-import http://axelor.com/xml/ns/data-import/data-import_5.4.xsd">
<!-- IMPORT DU PACKAGE 'AUTH' -->
<input file="auth_permission.csv" separator=";" type="com.axelor.auth.db.Permission"
search="self.name = :name"/>
@carld
carld / tsort.g
Created June 8, 2020 06:27 — forked from hilverd/tsort.g
Topological sort in Graphviz's gvpr
BEGIN {
int visited[node_t];
int visit(node_t n, edge_t e) {
if (visited[n] == 0) {
visited[n] = 1;
for (e = fstin(n); e; e = nxtin(e)) {
visit(e.tail, NULL);
}
@estorgio
estorgio / Mounting VirtualBox shared folders on Ubuntu Server 18.04 LTS (Bionic Beaver).md
Last active November 19, 2024 05:25
Mounting VirtualBox shared folders on Ubuntu Server 18.04 LTS (Bionic Beaver)

Mounting VirtualBox shared folders on Ubuntu Server 18.04 LTS (Bionic Beaver)

This guide will walk you through the steps on how to setup a VirtualBox shared folder inside your Ubuntu Server guest.

Prerequisites

This guide assumes that you are using the following setup:

You could still make this guide work with other setups (possibly with some modifications to the commands and whatnot).

@reachsumit
reachsumit / Audio Steganography_ultrasound - sender.ny
Last active March 25, 2024 16:06
This code was shared by Audacity user edgar-rft (https://forum.audacityteam.org/memberlist.php?mode=viewprofile&u=5642) to generate silent subliminals and is an implementation of Oliver M. Lowery's 1989 patent (https://patents.google.com/patent/US5159703A/en).
;nyquist plug-in
;version 1
;type process
;name "Subliminal..."
;action "Subliminal..."
;control carrier "Carrier" real "Hz" 17500 14000 20000
(setf carrier (max 14000 (min carrier 20000)))
;; We have two Nyquist frequencies, carrier/2 and *sound-srate*/2.
@ripesunflower
ripesunflower / tap.md
Created September 15, 2017 06:14
The Task-based Asynchronous Pattern
@staydecent
staydecent / decouple-react-api-calls.md
Last active May 14, 2018 18:28
How to keep API calls decoupled from React components

Keeping API calls decoupled from React components keeps your views pure and without side-effects! This makes it easier to test your views without having to worry about API calls. You can test your API separately from your views.

Some Assumptions

Before I dive any deeper, here are some assumptions: You are using React to render your views (HTML). You are using Redux, or something similar to handle state. Myself, I actually use Preact and Atom instead of React and Redux -- They are both much smaller and their source codes are easy to understand, which I favour. The APIs are basically the same. And, I'm also assuming you rely heavily on Redux/Atom and not on React's setState method.

Moving Request Logic Outside Of Your Views

If you're coming from MVC, then you know your views should be simple and without complex logic. Instead, you would use the Controller to load remote data and do any normalization. But where is the Controller when using React and Redux? There isn't really a controller, but that

/*
Everything with no dependencies comes first. That way, when a new item is added with a dependency on an existing item, it doesn't cause the existing item to jump.
Of course an existing item taking a dependency on an existing item will cause a jump, may as well move the changing item.
An existing item taking a dependency on a new item will also jump. It doesn't really make sense to putting the new item first, out of order, if it doesn't have dependencies.
Basically: order by depth_of_deepest_dependency, original_order
*/
with
creating_objects as (

Code Review

A consolidation of advice and stuff from the internet

What is code review?

Code review one person reading over another's code and offering comments, suggestions, and feedback about how it could be improved. Often this is done at companies or in open source projects as a required step before proposed changes can be merged into a

@ntamvl
ntamvl / controller-concerns-in-rails-4.md
Last active May 12, 2022 14:34
Controller Concerns in Rails 4

Controller Concerns in Rails 4

If you setup a Rails 4 app, you’ll notice the app/models/concerns and app/controllers/concerns directories. Concerns are modules that can be mixed into your models and controllers to share code between them.

Some developers falsely classify mixins as composition when they are actually a form of inheritance. When you include a module in a class, that module’s methods are added to the inheritance chain just like a parent class’ methods are added to a subclass. So, don’t think you’ve solved the problem of inheritance by simply splitting your inherited code into separate files!

That being said, mixins can be a valuable tool to share code between classes that are otherwise unrelated. Here’s an example of how I chose to use it recently.

I am adding admin reporting features to an app I’m hoping to launch soon. I have an admin controller with a simple before filter to redirect if the current user is not an administrator.

class AdminController < ApplicationController