Skip to content

Instantly share code, notes, and snippets.

View Dellos7's full-sized avatar

David López Castellote Dellos7

View GitHub Profile
@Dellos7
Dellos7 / README.md
Last active December 5, 2023 22:51
How to block Spotify and most apps ads (valid also for Android & iOS)

Block Spotify ads (and most app ads)

This is a how-to guide in order to block Spotify ads. However, this will also block most apps ads as apps usually use very similar ad providers.

Disclaimer

This guide was done with the only aim of learning.

Blocks ads in desktop and mobile

@gregkorossy
gregkorossy / semaphore.js
Last active September 15, 2023 08:08
A simple implementation of a semaphore in JS
function Semaphore(max) {
var counter = 0;
var waiting = [];
var take = function() {
if (waiting.length > 0 && counter < max){
counter++;
let promise = waiting.shift();
promise.resolve();
}
@Dellos7
Dellos7 / record.js
Last active November 19, 2023 17:38
SugarCRM - Open selection-list drawer with custom collection
initialize: function(options) {
this.plugins = _.union(this.plugins, ['LinkedModel']);
this._super('initialize', [options]);
//Example of use
this.search( 'ProductTemplates', 'revenuelineitem_templates','what I want to search' );
},
/**
@param module: The module of the collection you want to retrieve records from
@Dellos7
Dellos7 / AccessibilityClassHack.php
Created July 14, 2017 22:49
Helper class that allows to read private & protected properties from a specific object and also to invoke private & protected methods from a specific object
<?php
class AccessibilityClassHack {
/**
* Allows you to get the value of a protected or private property of an object
* @param $obj The class object of the property you want to get access to
* @param $prop The name of the property you want to get access to
* @return Returns the property $prop value of the object $obj
*/
@ccnokes
ccnokes / rx-online-offline.js
Last active October 11, 2022 14:18
Online/offline event observable with RxJS (see comments below for a better, more up-to-date way of doing this)
const { Observable } = require('rxjs/Observable');
require('rxjs/add/observable/fromEvent');
require('rxjs/add/operator/map');
require('rxjs/add/observable/merge');
function createOnline$() {
//merge several events into one
return Observable.merge(
//use .map() to transform the returned Event type into a true/false value
Observable.fromEvent(window, 'offline').map(() => false),
@churro-s
churro-s / LetsEncrypt_HTTPS_plex.MD
Last active February 25, 2024 11:52
Setup Let's Encrypt certificate for use with Plex Media Server on Ubuntu
@micahgodbolt
micahgodbolt / wsl_install_node.md
Last active December 22, 2022 09:37
WSL install Node

The apt-get version of node is incredibly old, and installing a new copy is a bit of a runaround.

So here's how you can use NVM to quickly get a fresh copy of Node on your new Bash on Windows install

$ touch ~/.bashrc
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
// restart bash
$ nvm install --lts
@ericcornelissen
ericcornelissen / function-pipeline-creator.js
Last active May 15, 2019 23:33
Functional JavaScript: simple function pipeline creators
let pipe = function() {
let functions = arguments,
intermediate = undefined;
return function() {
intermediate = functions[0].apply(this, arguments);
for(let i = 1; i < functions.length; i++) {
intermediate = functions[i](intermediate);
}
@dmulvi
dmulvi / subpanel-list.js
Created August 14, 2015 20:52
create a custom subpanel-list row action
// this file also goes in custom/SUBPANEL_MODULE_NAME/clients/base/views/subpanel-list/
({
extendsFrom: 'SubpanelListView',
initialize: function(options) {
this._super('initialize', [options]);
this.context.on('button:custom_action:click', this.customAction, this);
},
@amusarra
amusarra / HasUserRoleNameExpression.php
Last active May 1, 2019 04:50
SugarCRM 7: How to make certain fields readonly
<?php
/**
* Project: SugarCRM Logic Expression for checking User role
* Original Dev: Antonio Musarra, January 2014
* @2009-2014 Antonio Musarra <antonio.musarra[at]gmail.com>
*
* Desc: SugarCRM Logic Expression ext class
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by