Skip to content

Instantly share code, notes, and snippets.

View manuelpuyol's full-sized avatar

Manuel Puyol manuelpuyol

View GitHub Profile
@manuelpuyol
manuelpuyol / intl.cpp
Last active March 13, 2024 18:08
Intl demo for Hermes
// based on https://github.com/tmikov/hermes-jsi-demos/blob/master/hello/hello.cpp
// Intl calls from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat
#include <hermes/hermes.h>
#include <iostream>
/// JS code to be executed.
static const char *code = R"(
const date = new Date(Date.UTC(2020, 11, 20, 3, 23, 16, 738));
print('Expected output: "12/20/2020"')
@manuelpuyol
manuelpuyol / primer-color-scheme-load-test.js
Created March 1, 2024 22:28
Scripts to measure how long @primer/react colorSchemes takes to calculate
console.time('load')
const isObject = require('lodash.isobject')
const isEmpty = require('lodash.isempty')
const dark_colorblind = {
canvasDefaultTransparent: 'var(--bgColor-transparent, var(--color-canvas-default-transparent, rgba(13,17,23,0)))',
pageHeaderBg: 'var(--page-header-bgColor, var(--color-page-header-bg, #0d1117))',
marketingIcon: {
primary: 'var(--color-marketing-icon-primary, #79c0ff)',
class ComponentStatusMigratorGenerator < Thor::Group
include Thor::Actions
# Define arguments and options
argument :name
class_option :status, default: "alpha", desc: "Status of the component. One of alpha, beta or stable"
def self.source_root
File.dirname(__FILE__)
end
@manuelpuyol
manuelpuyol / utilities_bench.rb
Created July 21, 2021 17:45
Create a copy of the old `Primer::Classify::Utilities` and rename it `Primer::Classify::UtilitiesOld` before running
# frozen_string_literal: true
require "benchmark"
require_relative "lib/primer/classify/utilities"
require_relative "lib/primer/classify/utilities_old"
# make sure YML is loaded
Primer::Classify::Utilities::UTILITIES
Primer::Classify::UtilitiesOld::UTILITIES
@manuelpuyol
manuelpuyol / knapsack_data.rb
Created May 28, 2018 16:30
This is a simple script used calculate average spec files running time across multiple builds using Knapsack API. It requires that the KNAPSACK_API_TOKEN variable is set. It runs by default for the last 10 builds, but you can customize it passing the number of builds you want as an argument. Lastly, it returns a specs.txt file with the average t…
# frozen_string_literal: true
require 'httparty'
REQUESTED_BUILDS = ARGV[0].to_i || 10
SPEC_FILES = {}
def get(url, options = {})
headers = {
'cache-control': 'no-cache',