Skip to content

Instantly share code, notes, and snippets.

View wagenet's full-sized avatar

Peter Wagenet wagenet

View GitHub Profile
@wagenet
wagenet / application_policy.rb
Created May 6, 2021 21:25
Graphiti + Pundit
# frozen_string_literal: true
class ApplicationPolicy
attr_reader :user, :record
def initialize(user, record)
@user = user
@record = record
end
class Target
def call
puts "Called"
end
end
module TargetPrepend
def call
puts "Prepend"
super
#!/usr/bin/env ruby
require 'json'
def run_cmd(cmd)
puts cmd
unless ENV['VERBOSE']
cmd = "#{cmd} > /dev/null"
end
system(cmd)
@wagenet
wagenet / 0-Cargo.toml
Last active April 10, 2018 17:38
Cargo Git Dependency Error
my-dep = { git = "https://abc123:@github.com/myuser/my-dep", tag = "v1.0.0" }
require 'json'
output = `yarn outdated --json`
json = JSON.parse(output)
items = if json['type'] == 'table'
keys = json['data']['head']
json['data']['body'].map do |row|
Hash[*row.map.with_index{|v,i| [keys[i], v] }.flatten]
@wagenet
wagenet / Makefile
Last active July 19, 2017 21:45
skylight-rust Makefile
# Fail if piped commands fail
SHELL=bash -o pipefail
# Absolute root of the project
ROOT := $(shell cd $(dir $(firstword $(MAKEFILE_LIST))) && pwd)
include $(ROOT)/mk/*.mk
RUST_VERSION := $(shell cat $(ROOT)/.rust-version)
RUSTUP = rustup run $(RUST_VERSION)
@wagenet
wagenet / glibc.md
Last active September 12, 2024 14:58
glibc Versions

glibc Versions

List of oldest supported version of top 10 Linux Distros and their glibc version according to distrowatch.com.

Summary

Out of all versions with published EOLs, 2.12 is the oldest glibc still active, found in CentOS 6.8.

If CentOS 6 and 7 are eliminated, the oldest glibc is 2.23 in Ubuntu and Slackware.

@wagenet
wagenet / skylight_dlopen.c
Created October 7, 2016 14:08
Skylight gem dynamic loading code
#include "skylight_dlopen.h"
#include "dlfcn.h"
sky_main_fn sky_main = 0;
sky_init_fn sky_init = 0;
sky_hrtime_fn sky_hrtime = 0;
sky_instrumenter_new_fn sky_instrumenter_new = 0;
sky_instrumenter_start_fn sky_instrumenter_start = 0;
sky_instrumenter_stop_fn sky_instrumenter_stop = 0;
sky_instrumenter_submit_trace_fn sky_instrumenter_submit_trace = 0;
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
"use strict";
/**
* TODO:
* - Generate definitions for prototype extensions
* - Handle additional JSDoc properties (@param, @return)
* - Define types of arrays where possible
* - Review situations where multiple types are possible
* - Review var-args
* - JSDoc for classes and namespaces if supported