Skip to content

Instantly share code, notes, and snippets.

View momolog's full-sized avatar

Alexander Presber momolog

View GitHub Profile
@momolog
momolog / keybase.md
Created June 1, 2019 16:55
keybase.md

Keybase proof

I hereby claim:

  • I am momolog on github.
  • I am saimiri (https://keybase.io/saimiri) on keybase.
  • I have a public key ASC-Jrd7IYVblYeHOQZZM4f_lvM7wK1e9Wp-UbiwXg2KrAo

To claim this, I am signing this object:

#!/usr/bin/env ruby
require 'json'
require 'httparty'
headers = {
'PRIVATE-TOKEN' => ENV['GITHOST_PERSONAL_API_TOKEN']
}
(1..121).each do |pid|
@momolog
momolog / githost-move-vars
Last active May 29, 2019 13:06
githost to gitlab variable transfer
#!/usr/bin/env ruby
# move me to ~/bin/githost-move-vars, make me executable and
# call me like githost-move-vars 101 1258608
require "httparty"
# WARNINGS:
# only works for up to 100 variables
# doesn't copy protected nor masked checkboxes
@momolog
momolog / nap
Created January 30, 2019 21:35
nap utility, put this into `~/bin/nap`
#!/bin/bash
if [ -z $1 ]; then
echo "No time provided. Usage: nap [-cl] [minutes]"
exit 2
fi
if [[ $1 == *c ]]; then
echo Cancelling sleep. PIDs \(if any\): `pgrep -f "nap"`
pkill -f "nap"
exit 0
fi
@momolog
momolog / test.rb
Created March 9, 2018 17:29
Runs just fine with "ruby test.rb" under ruby 2.5
require 'factory_bot'
class Training
attr_accessor :instructor
def save!; end
end
class User
attr_accessor :role
def save!; end
@momolog
momolog / Gemfile
Created February 25, 2018 16:06 — forked from roalcantara/Gemfile
Rails 4 + Paperclip + Amazon S3
#https://github.com/thoughtbot/paperclip
#http://rubydoc.info/gems/paperclip/Paperclip/Storage/S3
gem 'paperclip', github: 'thoughtbot/paperclip'
# S3 API
gem 'aws-sdk'
Test $a $b
isset() false false
empty() true true
is_null() true true
=== null true true
2.2.2 :010 > s = Struct.new(:member)
=> #<Class:0x007fc96203f2e0>
2.2.2 :011 > my_struct = s['value']
=> #<struct member="value">
$navi-width: 200px
html
height: 100%
margin: 0
body
margin: 0
height: 100%
.site-wrapper
position: relative
{div, h1, h2, img, form, input} = React.DOM
@SearchBox = React.createClass
render: ->
div className: 'searchbox-container',
React.createElement Form, searchText: this.state.searchText, onSearchChange: this.searchChanged, onFocus: this.onFocus, onBlur: this.onBlur
React.createElement ResultList, data: this.state.data, category: this.state.category, visible: (this.state.hasResults && this.state.focus)
searchChanged: (val) ->
clearTimeout(this.searchTimeout)