Skip to content

Instantly share code, notes, and snippets.

eljojo / function.rb
Last active July 20, 2023 06:08
Simple Open AI API Client
# frozen_string_literal: true
module Ai
class Function
# Returns a formatted function payload
def to_payload
"name" => name,
"description" => description,
"parameters" => parameters,
eljojo / css_classes.rb
Last active June 18, 2023 23:41
proof of concept on how to have Phlex generate CSS classes
# frozen_string_literal: true
module Views
module CssClasses
extend ActiveSupport::Concern
class CssHelper; end
class_methods do
def css_helper
eljojo / Item URI2.js
Created December 21, 2022 16:54
zotero uri
"label":"Item URI para cucho",
eljojo / hardware-raspberry-pi.nix
Created January 9, 2022 01:12
nixos raspberry pi
{ config, lib, pkgs, modulesPath, ... }:
imports =
"${fetchTarball "" }/raspberry-pi/4"
boot.kernelPackages = pkgs.linuxPackages_rpi4;
boot.kernel.sysctl."vm.swappiness" = 0;
After=docker.service docker.socket
ExecStart=/usr/bin/docker run \
--rm \
--name=traefik \
eljojo / 0_reuse_code.js
Created July 5, 2017 13:17
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
eljojo / hash_manipulation.rb
Created December 8, 2015 19:41
some playing with functional programming and ruby
# A HashManipulation is a helper object.
# The idea is to aid when modifying hashes.
# changes =
# changes.key { |key| key.upcase }
# changes.value { |value| value.length }
# changes.("children" => [1, 2, 3]) # {"CHILDREN" => 3}
module Reports
class HashManipulation
def initialize
@key = -> (obj) { obj }
eljojo /
Last active August 29, 2015 14:22
Growth Hacking

I know about the existence of Growth Hacking and I know that as a StartUp one of your goals is to, well, grow as much as possible.
I also know about the existence of promotional posts, and how they can benefit both writers and companies looking to reach audiences.
What I didn't know, is how low some companies can go in order to promote their business for free.
Without further ado, here's an email I got yesterday. Let it speak by itself.

Hi Jose Tomas,

We’d love to see what tips you have for social media marketers. 

We would like you to create a post on your personal blog where you share

<title>This is the title</title>
<link rel="stylesheet" href="">
<link rel="stylesheet" href="">
<h1>Hello HTML!</h1>
<p>How's it going?</p>
<form action="/add_to_list" method="get">
eljojo / gist:be8a0feff34b4d02509b
Created May 4, 2015 17:38
root@dokku:~/dokku# make install
apt-get update
Hit jessie/updates InRelease
Hit jessie InRelease
Hit jessie/updates/main Sources
Hit jessie-updates InRelease
Hit jessie/updates/main amd64 Packages
Hit jessie/main Sources
Hit jessie/updates/main Translation-en
Hit jessie/main amd64 Packages