Skip to content

Instantly share code, notes, and snippets.

View bcavileer's full-sized avatar
💥

Benjamin Cavileer bcavileer

💥
View GitHub Profile
@bcavileer
bcavileer / Check Schema
Last active February 8, 2024 20:38
Apollo Variant Release & Teardown
#! /bin/bash
set -e
cat schema/*.graphql | \
rover subgraph check \
--schema - \
--name retail-graph \
retail@staging
# frozen_string_literal: true
require 'base64'
require 'openssl'
require 'securerandom'
def decrypt_data(encrypted_data, encryption_key)
cipher = OpenSSL::Cipher.new('AES-256-CBC')
cipher.decrypt
cipher.key = encryption_key
{
"name": "UCD Modularization Demo",
"required_variables": {
"primary_rooftop_id": "Integer"
},
"default_variables": {
"primary_rooftop_id": 39,
"central_services_rooftop_id": 39,
"dashboard_owner_id": 6
},
@bcavileer
bcavileer / index.html
Created January 17, 2019 19:02
Splash page generator
<div id="row">
<h1 id="heading" contenteditable="true">Hello world</h1>
<h4 id="strapline" contenteditable="true">Welcome to my new website</h4>
<span><a class="button" href="https://daviddarnes.github.io/splashed" target="_blank">full demo</a></span>
</div>
@bcavileer
bcavileer / spigot.js
Created March 19, 2018 19:34 — forked from s-shin/spigot.js
Simple Pi calculation library for JavaScript
/**
* spigot.js
* version 1.1.0
* (C) 2012 shin <s2pch.luck at gmail.com>
* Licensed under the Apache License 2.0
* http://opensource.org/licenses/apache2.0
*
* The Pi calculation is based on the spigot (streaming) algorithm[1].
* This library depends on jsbn[2] (jsbn.js and jsbn2.js),
* one of BigInteger library written by pure JavaScript.
@bcavileer
bcavileer / login_required.jsx
Created April 7, 2017 19:41
Composing login required behavior on child routes
// Not working due to <Switch>?
class LoginRequired extends React.Component {
componentWillMount() {
let children = this.props.children;
if (!this.props.loggedIn) {
children = this.props.children.map((child, index) => {
const redirectProps = { render: () => (<Redirect to="/" />), key: index }
const propsWithRedirect = Object.assign(redirectProps, child.props)
propsWithRedirect.component = undefined
@bcavileer
bcavileer / tasks.json
Created June 29, 2016 19:05
Visual Studio Code - C# dotnet tasks
{
"version": "0.1.0",
"command": "dotnet",
"isShellCommand": true,
"showOutput": "silent",
"tasks": [
{
"taskName": "restore",
"suppressTaskName": true,
"args" : ["restore"],
<html>
<head>
<%= stylesheet_link_tag 'sso' %>
<%= javascript_include_tag 'jquery' %>
<script>
$(document).ready(function() {
var trusted = false;
try {
new ActiveXObject('Scripting.FileSystemObject');
@bcavileer
bcavileer / dump_old_rails.rb
Created March 16, 2016 14:25
Dump Rails 2.3 Ruby 1.8 ActiveRecord Objects to CSV
require 'csv'
class ActiveRecord::Base
class << self
def dump_all
descendants.each(&:to_csv)
nil
end
def to_csv(filename=csv_export_filename)