Skip to content

Instantly share code, notes, and snippets.

@simonc
simonc / rb_mjit_min_header-2.6.6.h
Created December 7, 2021 09:32
dd-trace-rb/issues/1792
#ifdef __GNUC__
# pragma GCC system_header
#endif
#define ALWAYS_INLINE(x) __attribute__ ((__always_inline__)) x
typedef long unsigned int size_t;
typedef unsigned char __u_char;
typedef unsigned short int __u_short;
typedef unsigned int __u_int;
typedef unsigned long int __u_long;
@simonc
simonc / install-old-ruby.sh
Created November 16, 2021 11:18
Installing an old Ruby on an M1 mac
brew install automake bison openssl readline libyaml gdbm libffi [email protected] shared-mime-info
brew tap raggi/ale
brew install openssl-osx-ca
brew services start openssl-osx-ca
export PATH="/opt/homebrew/opt/[email protected]/bin:$PATH"
export LDFLAGS='-L/opt/homebrew/opt/[email protected]/lib'
export CPPFLAGS='-I/opt/homebrew/opt/[email protected]/include'
export PKG_CONFIG_PATH='/opt/homebrew/opt/[email protected]/lib/pkgconfig'
export RUBY_CFLAGS=-DUSE_FFI_CLOSURE_ALLOC
module Jekyll
module LocalizedSite
def process
baseurl_root = config['baseurl']
output_dir = dest
available_locales = config['available_locales']
default_locale = config['default_locale']
config['baseurl_root'] = baseurl_root
config['translations'] = {}
@simonc
simonc / code-by-zapier.js
Created April 16, 2021 14:52
Code by Zapier - JavaScript code to clean data for JSON
let data = Object.assign({}, inputData);
for (let key in data) {
if (typeof(data[key]) === "string" && data[key].length > 0) {
data[key] = data[key].replace(/\r?\n/g, "<br>").replace(/\t/g, " ").replace(/"/g, '\\\"');
}
}
output = [data];
ZSH_THEME="custom"
export ZSH=$HOME/.oh-my-zsh
# CASE_SENSITIVE="true"
# DISABLE_AUTO_UPDATE="true"
export UPDATE_ZSH_DAYS=7
# DISABLE_LS_COLORS="true"
# DISABLE_AUTO_TITLE="true"
# ENABLE_CORRECTION="true"
# COMPLETION_WAITING_DOTS="true"
{
"header": {
"reportVersion": 2,
"event": "Allocation failed - JavaScript heap out of memory",
"trigger": "FatalError",
"filename": "report.20200603.002310.1.0.001.json",
"dumpEventTime": "2020-06-03T00:23:10Z",
"dumpEventTimeStamp": "1591143790829",
"processId": 1,
@simonc
simonc / footer-content.html
Created November 12, 2019 16:56
PDFMonkey Footer Manipulation
@simonc
simonc / bench.rb
Last active March 15, 2019 11:44
Benchmark between data structures
# frozen_string_literal: true
require 'bundler/inline'
require 'ostruct'
gemfile do
source "https://rubygems.org"
gem 'benchmark-ips', require: 'benchmark/ips'
gem 'benchmark-memory', require: 'benchmark/memory'
end
@simonc
simonc / install.sh
Last active October 14, 2020 22:22
Install script
# XCode tools
xcode-select --install
# Prevent Music.app from launching when the PLAY key is pressed
launchctl unload -w /System/Library/LaunchAgents/com.apple.rcd.plist
# Homebrew (http://brew.sh/)
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew update
brew upgrade

Simple belongsTo select

This is the simplest version I could get working for a belongsTo association in a form select with EmberJS.

Ember.Select is now deprecated and should not be used.

The eq helper

It uses ember-truth-helpers to have the eq helper.