Skip to content

Instantly share code, notes, and snippets.

View Largo's full-sized avatar
💭
Helping Ruby on Windows

Andi Idogawa Largo

💭
Helping Ruby on Windows
View GitHub Profile
@Largo
Largo / gist:082465017294ed233b9c2e0423f6d19e
Created February 1, 2024 15:08
ruby.wasm js lib missing?
bundle exec rbwasm --log-level debug build --ruby-version 3.3 --target wasm32-unknown-wasi --build-profile full -o ruby.wasm --save_temps
==> tar -C /tmp/d20240201-102438-7rub7v/usr -xzf /home/andi/workspace/learn/wasiKoans/test/rubies/ruby-3.3-wasm32-unknown-wasi-full-2c45fb4d6600cf1586515950a8000c70.tar.gz --strip-components\=2
INFO: Packaging gem: js-2.5.0
INFO: Packaging gem: rainbow-3.1.1
DEBUG: Packaging gem file: bundle/gems/js-2.5.0/ext/js/extconf.rb
DEBUG: Packaging gem file: bundle/gems/js-2.5.0/ext/witapi/extconf.rb
DEBUG: Packaging gem file: bundle/gems/rainbow-3.1.1/Changelog.md
DEBUG: Packaging gem file: bundle/gems/rainbow-3.1.1/LICENSE
DEBUG: Packaging gem file: bundle/gems/rainbow-3.1.1/README.markdown
@Largo
Largo / app.rb
Created June 12, 2023 03:08
Ruby and VLC gtk. Probably doesn't work
# released under the public domain
# I have sort of gotten this to work last year, but I'm in a hurry now. I think it doesn't completely work with GTK...
require 'gtk3'
#require 'vlc'
require_relative 'vlc'
require 'ffi'
module User32
@Largo
Largo / chatgpt-ruby-hash-keys.txt
Last active December 14, 2022 07:51
Asking ChatGPT to teach me how to turn hash keys into variables without repeating myself.
ChatGPTにハッシュキーを直接変数にするように依頼しました。何度か繰り返した結果、うまくいきました。一体どうすればいいのでしょうか?
Ruby: ハッシュを返すメソッドがあるのですが、そのメソッドを使うときにハッシュのキーを変数として使うにはどうしたらいいですか?繰り返しにならないようにね。ハッシュのキーは変数として使えるようにすればいいんだよ。
Ruby: I have a method that returns a hash, how can use the hash keys as variables when I use the method. I don't want to repeat myself. The hash keys should just become variables that I can use.
To use the keys of a hash as variables, you can use Ruby's Object#instance_variable_set method, which allows you to set the value of an instance variable using a string that specifies the name of the variable.
ハッシュのキーを変数として使うには、Ruby の Object#instance_variable_set メソッドを使います。このメソッドでは、変数名を指定した文字列を使ってインスタンス変数の値を設定することができます。
@Largo
Largo / chatgpt-network-error-workaround.txt
Last active December 14, 2022 02:47
Workaround for Network Error in ChatGPT
I asked chatgpt for a workaround and it gave me this. you'll have to paste it into the developer console. (usually never ever do this)
you will then see the results in the developer console (the ones that manage to come in)
// Select the node that will be observed for mutations
const targetNode = document.body;
// Options for the observer (which mutations to observe)
const config = { childList: true, subtree: true };
// Callback function to execute when mutations are observed
<?php
require_once('TwitterAPIExchange.php');
function getLastPlayedSong($username, $apiKey) {
$url = "http://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=" . $username .
"&api_key=" . $apiKey ."&format=json";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$rawData = curl_exec($ch);
curl_close($ch);
require 'csv'
require 'open-uri'
zeilen = CSV.read('images.csv', { :col_sep => ';' })
listeMitBilderProSku = zeilen.group_by{|x| x[0] }
#p listeMitBilderProSku
listeMitBilderProSku.each do |bilderProSku|
sku = bilderProSku[0]
@Largo
Largo / index.html
Created January 22, 2016 14:59 — forked from anonymous/index.html
Whole lot of shaking going on // source http://jsbin.com/hitabi
<!DOCTYPE html>
<html>
<head>
<link href='http://fonts.googleapis.com/css?family=Roboto:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<meta charset="utf-8">
<title>Whole lot of shaking going on</title>
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/animate.css/3.1.1/animate.min.css" />
<style id="jsbin-css">
.box {
@Largo
Largo / index.html
Created January 22, 2016 14:58 — forked from anonymous/index.html
Editor // source http://jsbin.com/yinuyu
<!DOCTYPE html>
<html>
<head>
<link href='http://fonts.googleapis.com/css?family=Inconsolata:400,700' rel='stylesheet' type='text/css'>
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<meta charset="utf-8">
<title>Editor</title>
<style id="jsbin-css">
* { box-sizing: border-box }
@Largo
Largo / gist:d7371d4ba8c8846fdc38
Last active August 29, 2015 14:22
No warranties. This is very beta extension for implementing the drag and drop order function in bolt. you need a taxonomy "sortierung" and shouldn't have any other taxonomies, because it might not work
<?php
namespace Bolt\Extension\Largo\SortOrder;
use Symfony\Component\HttpFoundation\Response;
use Bolt;
class Extension extends \Bolt\BaseExtension
{
/** @var boolean */
private $isAdmin;
<!DOCTYPE html>
<html>
<head>
<link href='http://fonts.googleapis.com/css?family=Inconsolata:400,700' rel='stylesheet' type='text/css'>
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<meta charset="utf-8">
<title>Editor</title>
<style id="jsbin-css">
* { box-sizing: border-box }