Skip to content

Instantly share code, notes, and snippets.

View codebryo's full-sized avatar
🚀
...

Roman Kuba codebryo

🚀
...
View GitHub Profile
@codebryo
codebryo / delete_branches_on_page.js
Last active November 28, 2022 10:38
If you want to quickly delete all branches visible on one page in GitHub (e.g. stale branches) this script will click all those bucket buttons for you.
// Self executing loop staggered with delete requests to deal with local GH js rerenders
// Experiment with the timedelay of 1000 by default
var buttons = Array.from(document.querySelectorAll('button[title^="Delete "]'));
function loopIt(x) {
setTimeout(() => {
buttons[x].click();
if(x < buttons.length -1) loopIt(x+1);
}, 1000);
};
loopIt(0);
@codebryo
codebryo / headway.vue
Created October 12, 2018 08:15
Loading Headway as Vue Widget
<template>
<div v-click-outside="hide" class="changelog">
<div class="anchor"><!-- This is a Icon we use --></div>
</div>
</template>
<script>
import uuid from 'uuid/v4'
import ClickOutside from 'vue-click-outside'
@codebryo
codebryo / app.js
Created October 11, 2018 11:02
Rails vue_app helper support
/* globals Vue, Vuex */
import { merge, entries } from 'lodash'
const rootNodeSelector = '#page[vue-app]' // Entry point on the page to support global components
let iterator = 1
window.appHasBeenSetupOnce = false // Added support for loading multiple apps on one page
function setup (rootComponentNeedSeperateMount) {
window.appHasBeenSetupOnce = true
@codebryo
codebryo / Overview.spec.js
Created December 12, 2017 20:21
Spec Review + Improvement
import { createLocalVue, shallow } from 'vue-test-utils'
import VueRouter from 'vue-router'
import Vuex from 'vuex'
import moxios from 'moxios'
import Overview from '../../resources/assets/js/components/Overview.vue'
const factory = function() {
const localVue = createLocalVue()
localVue.use(VueRouter)
@codebryo
codebryo / model.js
Created July 3, 2017 15:54
Javascript collection Model
class Model {
constructor(arr = []) {
if (!_.isArray(arr))
throw new Error('First model param needs to be an Array!')
this._collection = new Array(...arr)
}
/**
* Get size
@codebryo
codebryo / capybara_cheay_sheet.rb
Last active December 9, 2016 13:36
Capybara Cheat Sheet
#
# Navigating to pages
#
visit '/account'
visit account_path(account)
#
# Assertions (URL)
#
expect(page).to have_current_path('user/edit')
@codebryo
codebryo / What_the_error.coffee
Created June 3, 2016 08:52
Me trying to understand what's going on with error rendering, fetching and so on in a Angular based project
# As I understand it
# 1. When Build is Finished - GET ERRORS FROM THE SERVER
# 2. Collect Errors for the whole build
# 3. Show those Errors
# 4. Allow to click on any error to make it disappear
# WHAT I FOUND SPLITTED INTO 2 FILES
# GLOBAL Variables
@codebryo
codebryo / inputs.scss
Created October 21, 2014 09:47
SCSS Selector Grouping, Interpolation & Manipulation
/*
* This approach was initally inspired by Bourbons (bourbon.io) approach on packing CSS Selectors together in one
* variable so you can easily do stuff with a group of selectors.
* Since the SASS 3.4 release you don't need any extra mixins to append classes or pseudo-classes on a selector list.
*/
// Our Collection of input types we want to bind together
$_inputs-list:'input[type="email"]',
'input[type="number"]',
@codebryo
codebryo / example.slim
Last active August 29, 2015 14:05
Render/Include Slim Partials in Codekit
== Slim::Template.new('partials/_test.slim').render
@codebryo
codebryo / mailConverter
Last active August 29, 2015 13:59
Quick way to replace mail-like addresses with real anchors.
/*
* mailConverter Script
* author: Roman Kuba, Codebryo
* web: codebryo.com
*
*/
// Lets pretend you want to have mail-address on your website but maybe want to protect it from being grabbed through bots
// This script turns a textelement into an useable link
// It removes spaces and replaces [at] with @ and [dot] with .