Skip to content

Instantly share code, notes, and snippets.

View josepcrespo's full-sized avatar

Josep Crespo Santacreu josepcrespo

View GitHub Profile
@AndreiTelteu
AndreiTelteu / Custom bread field type .md
Last active February 26, 2024 09:37
Custom bread field type stored in json format. For Laravel + Voyager admin panel

1. A new file: /app/Admin/FormFields/CustomFieldHandler.php

<?php
namespace App\Admin\FormFields;

use TCG\Voyager\FormFields\AbstractHandler;

class CustomFieldHandler extends AbstractHandler
{
@ismyrnow
ismyrnow / mac-clear-icon-cache.sh
Created May 5, 2017 19:28
Clear the icon cache on a Mac when you start seeing generic icons in Finder or the Dock
sudo rm -rfv /Library/Caches/com.apple.iconservices.store; sudo find /private/var/folders/ \( -name com.apple.dock.iconcache -or -name com.apple.iconservices \) -exec rm -rfv {} \; ; sleep 3;sudo touch /Applications/* ; killall Dock; killall Finder
@jherax
jherax / arrayFilterFactory.1.ts
Last active July 18, 2024 15:02
Filters an array of objects with multiple match-criteria.
type FilterOperator = 'AND' | 'OR';
type FiltersBy<T> = {
[K in keyof T]?: (value: T[K]) => boolean;
};
/**
* Factory function that creates a specialized function to filter
* arrays, by validating all filters (AND operator),
* or validating just one of the filters (OR operator).
* @param operator Method to validate all filters: AND, OR
@geuis
geuis / gist:8b1b2ea57d7f9a9ae22f80d4fbf5b97f
Last active January 10, 2024 16:43
Get Youtube video urls
// Run from the dev tools console of any Youtube video
// Accurate as of July 2, 2020.
//
// Copy and paste this into the dev console in a browser with the desired video loaded.
//
// NOTE: Some Youtube videos do not directly expose the video url in the response.
// This script doesn't currently attempt to handle those. It will work for most other general video types though.
(async () => {
const html = await fetch(window.location.href).then((resp) => resp.text()).then((text) => text);
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://cloud.feedly.com/v3/subscriptions");
$headers = array("Authorization: OAuth [Add your dev token here]");
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$output = curl_exec($ch);
@shmup
shmup / torrents.md
Last active July 15, 2024 20:36
transmission blocklist guide

Transmission Blocklist

The Transmission torrent client has an option to set a Blocklist, which helps protect you from getting caught and having the DMCA send a letter/email.

It's as simple as downloading and installing the latest client:

@kevin-smets
kevin-smets / iterm2-solarized.md
Last active July 22, 2024 22:13
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@joshbeckman
joshbeckman / animatedScrollTo.js
Created September 30, 2013 14:51
ScrollTo animation using pure javascript and no jquery
document.getElementsByTagName('button')[0].onclick = function () {
scrollTo(document.body, 0, 1250);
}
function scrollTo(element, to, duration) {
var start = element.scrollTop,
change = to - start,
currentTime = 0,
increment = 20;
@hlashbrooke
hlashbrooke / function.js
Created July 12, 2013 11:03
Simple animated scroll for jQuery
function scrollToElement( target ) {
var topoffset = 30;
var speed = 800;
var destination = jQuery( target ).offset().top - topoffset;
jQuery( 'html:not(:animated),body:not(:animated)' ).animate( { scrollTop: destination}, speed, function() {
window.location.hash = target;
});
return false;
}
@d3m3vilurr
d3m3vilurr / feedly_api.md
Last active March 30, 2024 08:21
Unofficial Feedly API Document

IDs

  • user_id - user/:uid
  • feed_id - feed/:feed_uri
  • category_id - :user_id/category/:category (special category: global.all, global.uncategorized)
  • tag_id - :user_id/tag/:tag (special tag: global.saved)

APIs

http://cloud.feedly.com/:version/:api