Skip to content

Instantly share code, notes, and snippets.

@aelaguiz
aelaguiz / ctransformers_embeddings.py
Created December 20, 2023 03:56
Langchain + CTransformers embedding function
from langchain_community.llms.ctransformers import CTransformers
from langchain_core.embeddings import Embeddings
from typing import List
import asyncio
class CTransformersEmbeddings(Embeddings):
def __init__(self, llm):
self.llm = llm
const solana = require('@solana/web3.js');
const splToken = require('@solana/spl-token');
const mplTokenMetadata = require("@metaplex-foundation/mpl-token-metadata");
const metaplex = require('@metaplex/js');
const key = require('./key.json');
const run = async() => {
const kp = solana.Keypair.fromSecretKey(Buffer.from(key));
const connection = new solana.Connection(
@aelaguiz
aelaguiz / gist:c711f7cbc58dcae34fd4
Created April 7, 2015 16:14
Add a product to the cart on Cratejoy via JS
$.ajax({
url: '/cart/add',
type: 'POST',
data: {
product_id: 1579,
term_cycles: 3,
'variant:Color': 'silver'
}, success: function(data) {
console.log('Cart Item ID: ' + data.id);
console.log('Cart size: ' + data.cart_size);
@aelaguiz
aelaguiz / CratejoyIsHiring.js
Last active September 22, 2023 15:08
Cratejoy (YC S13) - Hiring a killer JS Front-End Engineer to build v4 of our website builder
// CratejoyIsHiring.js
define(['backbone', 'underscore'], function(Backbone, _) {
var CratejoyJavascriptJob = {
needs: {
'Rebuild our website builder': {
description: 'Website builder is on v3, you\'ll build v4',
requirements: [
'Easy to use for non-technical people',
'Powerful enough for design agencies',
@aelaguiz
aelaguiz / subscribe.html
Created November 23, 2014 18:49
Metafields
{% extends "base.html" %}
{% macro ship_option(product, discount) %}
{% if product.ship_option_string == "pricedin" %}
<p class="ship_discount sml-text">FREE Shipping
{% if discount %}
<br />Save {{ ((1 - discount) * 100) | int }}%
{% else %}
<br />
{% endif %}
@aelaguiz
aelaguiz / html
Last active August 29, 2015 14:09
Font example
<h1 class="my-class">Custom header</h1>
@aelaguiz
aelaguiz / index.html
Created August 6, 2014 13:09
Recipe: Embed an Image
<!-- Simplest case -->
{{ "images/my_image.png" | asset_url | img_tag }}
<!-- With alt -->
{{ "images/my_image.png" | asset_url | img_tag(alt="My image") }}
@aelaguiz
aelaguiz / asdfasdf
Created August 6, 2014 13:07
Test gist
Testasdf
<html>
<head>
<meta http-equiv="refresh" content="0; url=http://example.com/" />
</head>
<body></body>
</html>
<ul class="list-group">
<li class="list-group-item"><h4>Your Subscription(s)</h4></li>
{% set exists = [] %}
{% for sub in customer.subscriptions %}
{% if sub.store_id == store.id %}
{# This makes sure we know if we found a sub tied to the store #}
{% do exists.append(1) %}