Skip to content

Instantly share code, notes, and snippets.

View openscript's full-sized avatar
🌏
Coding everyday

Robin openscript

🌏
Coding everyday
View GitHub Profile
import { GatsbyNode } from 'gatsby';
import { resolve } from 'path';
export const createPages: GatsbyNode['createPages'] = async args => {
const { actions, graphql } = args;
const { createPage } = actions;
const allPages = await graphql<Queries.AllGenericPagesQuery>(`
query AllGenericPages {
allMdx(filter: { fields: { kind: { eq: "pages" } } }) {
edges {
# see https://github.com/brianfrankcooper/YCSB/wiki/Running-a-Workload
# see https://github.com/brianfrankcooper/YCSB/wiki/Core-Properties
require 'csv'
require 'logger'
# test parameters
@recordcount = 10000
@operationcount = 10000
@threads = (1..1) # (from..to)
@openscript
openscript / .env
Last active October 23, 2018 07:54
Rails Docker Configuration
DATABASE_USER=gugus
DATABASE_PASSWORD=gugus
RAILS_ENV=development
RACK_ENV=development
BUNDLE_PATH=/usr/local/bundle
USER_ID=1000
GROUP_ID=990
import * as ExtractTextPlugin from 'extract-text-webpack-plugin';
import * as path from 'path';
import {Configuration, DefinePlugin} from 'webpack';
const SpriteLoaderPlugin = require('svg-sprite-loader/plugin');
const config: Configuration = {
mode: 'development',
watch: true,
entry: ['./assets/scripts/index.ts', './assets/styles/index.scss', './assets/sprite/sprite.js'],
output: {
@openscript
openscript / README.md
Last active April 11, 2019 10:48
This bash script can be used to encrypt secrets for a Travis CI configuration (`.travis.yml`) with the project specific public key.

Usage

  • Download script travis-encrypt.sh
  • Make it executable chmod +x travis-encrypt.sh
  • Run the script with ./travis-encrypt.sh -r username/repositoryname -e example
    • It will return something like O+woVD9K+PeFrcyu5GCjKSFvfcSPwDW0kyDYEQnNbwt/iSkqjpl2OPA9W//KEKEB9UUSZD+XmQ3Ij0gnvJnOowcWY5sSeJlVEVTrSer0kW6uWpa/uWzDHCBz2YhBnI6u9SfYfMkhDl22pcaCEwaUkmK2gjcVo+v0bS8vAQFz0Na5/WiKj0GkSX50iIGgfaXheuC8KgIC25T0h+czpap7vb13OlblMnClfyTH9+TmAwTlcV7ljXpv1QY+K72L8jK1/CQVZ8quBYrBwwxO2V6cpXRMMCIw4m4lqxUyN4FBGnq7cJ7BWLzeqSMpFBoP+ZxAqS5yem8KLh1VkEo7PVjCkZE6M+2meFf2VJEVUs/KJY9xnH3eDzipWkwXon2qVpCkT7FDEzGFs/DapYsSo7eCO6pUYYhcpaYpWeYV9DSSV0QcrOeZp664iJMHWPSmrs/lESbbHpKWsM/AFVB9X75q/OB+QU0tQxpReZmKw3ZHbDVMlmlwhP8VSiQ05LV2W6gYzADGiUiL6n1X8teeHEVDSZnD7nrxMD/FchnWI5La3tZeFovRMf6hH3NItW+QZaGaGNftJrP488J/F2hCycPJk3+YrxbBCGHE2X379QbkMz3S0B5UiAcJKmwuTstF6X3CCurZVYIkUGGXhnmalPtVpEqxeTiLw5RU6C9z2qSwhhw=
  • Use the encrypted secret in your .travis.yml according to https://docs.travis-ci.com/user/encryption-keys/#Usage
class PagesController < ApplicationController
def show
@page = nil
current = nil
params[:slug].split('/').reverse.each do |s|
if current
current = current.parent.where(slug: s)
else
@page = Page.find_by(slug: s)
current = @page