Skip to content

Instantly share code, notes, and snippets.

View manuelmeurer's full-sized avatar
🤷‍♂️

Manuel Meurer manuelmeurer

🤷‍♂️
View GitHub Profile
@manuelmeurer
manuelmeurer / workers.js
Created February 23, 2022 08:49
Uplink Cloudflare Workers
addEventListener('fetch', event =>
event.respondWith(handleRequest(event.request))
)
const sitemapUrl = "https://uplink-files.s3.eu-central-1.amazonaws.com/sitemap.xml"
const mediumBlogPostPaths = [
'/announcing-our-cooperation-with-expath-to-help-freelancers-get-started-in-germany-49edbd765992',
'/why-you-should-work-freelance-as-a-software-developer-in-germany-52de81082f6f',
'/why-are-many-it-recruiters-technically-completely-incompetent-e924f559ed0e',
'/announcing-our-new-partner-exali-5c9acfb34e1c',
@manuelmeurer
manuelmeurer / swap.yml
Created June 30, 2015 09:29
Ansible role for creating a Swap file
- name: set swap_file variable
set_fact:
swap_file: /mnt/{{ swap_space }}.swap
- name: check if swap file exists
stat:
path: "{{ swap_file }}"
register: swap_file_check
- name: create swap file
@manuelmeurer
manuelmeurer / _etc_monit.d_mysql
Last active January 10, 2021 21:38
Monit config files
check process mysql
with pidfile /var/run/mysqld/mysqld.pid
start program = "/usr/sbin/service mysql start" with timeout 60 seconds
stop program = "/usr/sbin/service mysql stop" with timeout 60 seconds
if totalmem > 400 MB for 5 cycles then alert
if totalmem > 600 MB for 5 cycles then restart
if cpu > 50% for 5 cycles then alert
if cpu > 90% for 5 cycles then restart
if 3 restarts within 5 cycles then timeout
@manuelmeurer
manuelmeurer / gist:270548a2a4939d8d986a
Created May 5, 2014 08:39
Error building ack from faster-g branch
10:35:04 ~/code/ack2 (dev) $ g co origin/faster-g
Note: checking out 'origin/faster-g'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
@manuelmeurer
manuelmeurer / Instructions.md
Created March 29, 2016 19:10
Bowling Code Challenge

Bowling Code Challenge

  • Please create a repository in GitHub (or a similar service) so that we can follow your progress.
  • The implementation should use "vanilla" JavaScript (no libraries or frameworks).
  • Remember that we are more interested how you approach this problem than seeing you complete all the features (if you don't have enough time to finish everything, simply explain how you would continue the implementation).

Minimum requirements

  • Implement a scoring system for a bowling game according to these rules:
  • A game consists of 10 frames.
@manuelmeurer
manuelmeurer / gist:d8f29185b653412ed5d17c6649e18464
Last active May 14, 2018 08:32
RubyMotion blog post feedback
- "monthly RubyMotion meetup" - where can I find info about this? Is it a real-world meetup or online? I googled it and found
this post from 2013: http://www.rubymotion.com/news/2013/04/12/announcing-motionmeetup-monthly-online-rubymotion.html
But the link to http://meetup.rubymotion.com/ is dead.
- The link to http://rubymotion.com/applied that is mentioned in the README on https://github.com/amirrajan/rubymotion-applied
is also dead. Where can we find the community-driven part of RubyMotion documentation?
- "RubyMotion's templates are now open source" - I'd recommend adding a link to
https://github.com/amirrajan/rubymotion-templates.
@manuelmeurer
manuelmeurer / store_stylesheet.rb
Last active March 5, 2018 12:16
How to compile custom Sass stylesheets during runtime
# lib/store_stylesheet.rb
class StoreStylesheet
def initialize(store)
@store = store
end
# The path of the compiled stylesheet, i.e. stores/id_timestamp.css
def stylesheet_file
filename = [
@store.id,
@manuelmeurer
manuelmeurer / qad_amazon_export.rb
Created September 6, 2011 11:49
Quick and dirty Amazon product export to a CSV file
#!/usr/bin/env ruby
require 'amazon_product'
require 'csv'
AWSKey = ''
AWSSecret = ''
AWSAssociateTags = {
:de => '',
@manuelmeurer
manuelmeurer / paypal_controller.rb
Created March 8, 2014 10:03
Paypal Recurring stuff
class Admin::PaypalController < AdminController
skip_load_and_authorize_resource
before_filter :load_current_account, except: :ipn
skip_before_filter :authenticate_admin_user!, :verify_authenticity_token, :redirect_to_dashboard_if_account_is_disabled, :redirect_to_dashboard_if_maintenance, only: :ipn
rescue_from PaypalNotification::RecordInvalid, with: :notify_airbrake_and_render_nothing
rescue_from PaypalNotification::ResponseInvalid, with: :notify_airbrake_and_render_nothing
rescue_from PaypalNotification::HandlingFailed, with: :notify_airbrake_and_render_nothing
@manuelmeurer
manuelmeurer / controller.rb
Last active November 15, 2016 16:06
Render dynamic CSS
class Display::WidgetsController < ApplicationController
def show
scss = render_to_string('show', locals: { foo: bar }, formats: :scss)
@css = Sass::Engine.new(scss, Compass.sass_engine_options.merge(syntax: :scss)).render
end
end