Skip to content

Instantly share code, notes, and snippets.

View Vheissu's full-sized avatar
💭
SURFING THE INTERNET

Dwayne Charrington Vheissu

💭
SURFING THE INTERNET
View GitHub Profile
@linuxandchill
linuxandchill / retrievalQA.js
Last active May 5, 2024 17:37
Create and retrieve embeddings using Langchain and Supabase
////////////////////////////////////
/* "dependencies": {
"@supabase/supabase-js": "^2.13.1",
"langchain": "^0.0.44"
} */
////////////////////////////////////
import { OpenAI } from "langchain/llms";
import {
@codediodeio
codediodeio / database.rules.json
Last active January 28, 2024 19:07
Common Database Rules for Firebase
// No Security
{
"rules": {
".read": true,
".write": true
}
}
@karlding
karlding / itunes-artist-photos.md
Created March 3, 2016 05:17
Grab iTunes image artwork from the DOM using the Open Graph meta tags

iTunes Artist Photos

The iTunes API doesn't provide a way to grab artist images, but the iTunes website uses Open Graph meta tags, which embeds a meta tag with a property attribute value set to og:image. As it turns out, this seems to be the same image used in the iTunes artwork.

The URL structure is similar to the artworkUrl values returned by the API, but what concerns us here is the part I've indicated at the end of the URL.

http://is3.mzstatic.com/image/thumb/Music7/v4/68/68/41/68684190-833b-bfb4-5018-e5a2e6f69eb0/source/1200x630bf.jpg
                                                                                                   └─ widthxheight
@jsobell
jsobell / deepObserver.ts
Last active February 18, 2022 06:30
Deep observer for Aurelia
/**
* Created by Jason on 29/02/2016.
*
* constructor(public deepobserver:DeepObserver) {
* this.obsDisposer = this.deepobserver.observe(this, 'target', (n,o,p)=>
* { console.log('DATA CHANGED:', p, ':', o,'===>', n ); }
* }
* @bindable target:Object;
*
* To remove bindings, call this.obsDisposer();
export function abstract() {
return (cls, prop, descriptor) => {
if (prop === undefined) {
return class Abstract extends cls {
constructor(...args) {
super(...args);
if (this.constructor === Abstract) {
throw new Error('Class is abstract, and should not be instansiated.');
}
@simmo
simmo / throttle.js
Last active November 9, 2022 10:28
JavaScript Throttle using requestAnimationFrame
function throttle(type, name, obj) {
var running = false;
obj = obj || window;
var func = function() {
if (running) return;
running = true;
@danharper
danharper / CatchAllOptionsRequestsProvider.php
Last active April 20, 2024 01:53
Lumen with CORS and OPTIONS requests
<?php namespace App\Providers;
use Illuminate\Support\ServiceProvider;
/**
* If the incoming request is an OPTIONS request
* we will register a handler for the requested route
*/
class CatchAllOptionsRequestsProvider extends ServiceProvider {
@alexis89x
alexis89x / broadcast-channel-es6.js
Last active February 21, 2024 16:56
Broadcast Channel API polyfill
/**
@class BroadcastChannel
A simple BroadcastChannel polyfill that works with all major browsers.
Please refer to the official MDN documentation of the Broadcast Channel API.
@see <a href="https://developer.mozilla.org/en-US/docs/Web/API/Broadcast_Channel_API">Broadcast Channel API on MDN</a>
@author Alessandro Piana
@version 0.0.6
*/
/*
@Peleg
Peleg / fb_bd_liker.js
Created November 27, 2014 21:31
Facebook Birthday Liker - likes your friends' posts for your birthday
/**
*
* Facebook Birthday Liker -
* Likes your friends' posts for your birthday
*
* Usage:
* 1. Face the fact that you're an ungrateful, lazy being
* 2. Paste the following code in your console
*
*/
@abergs
abergs / rdel.ps1
Last active August 23, 2016 20:03
Remove node_modules
# By Anders and Henkan 2014-08-07 v1
# http://ideasof.andersaberg.com
$path = $args[0]
$chars = "abcdefghijklmnopqrstuvwxyz"
function GetFileName($num)
{
$name = ""
while($num -gt 25) {