Skip to content

Instantly share code, notes, and snippets.

View lenart's full-sized avatar
🎯

Lenart Rudel lenart

🎯
  • Ljubljana, Slovenia
View GitHub Profile
@lenart
lenart / index.html
Last active May 4, 2023 09:24
Drago Rudel: V dezeli Inkov
<!doctype html>
<html class="h-full">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.tailwindcss.com"></script>
<!-- ios thumbnail -->
<link rel="apple-touch-icon" sizes="180x180" href="https://user-images.githubusercontent.com/9228/236164238-103513de-300c-4e15-8141-762876b37c96.jpg" />
</head>
@lenart
lenart / index.html
Created August 24, 2020 10:07
Knjiga – Drago Rudel: Moja pot po Caminu francés
<!doctype html>
<html>
<head>
<title>Knjiga – Drago Rudel: Moja pot po Caminu francés</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="apple-touch-icon" href="https://user-images.githubusercontent.com/9228/91032481-4890e580-e602-11ea-94b8-fdedf4ba0414.png">
</head>
@lenart
lenart / kapetanovic.html
Last active April 5, 2022 06:23
Kapetanovic
<!doctype html>
<html>
<head>
<title>Ivan Kapetanović - Camino</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="apple-touch-icon" href="https://user-images.githubusercontent.com/9228/60210452-30d29b80-985d-11e9-8286-300d785ada63.png">
</head>
@lenart
lenart / pre-request-scripts.js
Created November 15, 2018 12:28
Postman auto fetch oAuth access token
// Add this script to collection's pre-request scripts
// Collection -> Edit -> Pre-request Scripts
// Automatically fetch oAuth access_token and store it for 1 hour
update_token = pm.environment.get("token_time");
if (typeof(update_token) == "undefined" || update_token <= Date.now()) {
console.log("Fetching new oAuth access token for user");
pm.sendRequest({
url: pm.environment.get("host") + pm.environment.get("token_path"),
@lenart
lenart / choose_password.html
Created February 1, 2017 18:55
Sample form for resetting password on parse-server (parseFrameURL)
<!--
parseFrameURL should point to this document.
Once the form is submitted it will:
- redirect to passwordResetSuccess if everything goes well
- redirect to invalidLink if data is invalid (eg. missing or invalid token, wrong email)
-->
<html>
<head></head>
<body>
<h1>Reset Your Password<span id='app'></span></h1>
@lenart
lenart / soft_deletable.rb
Created October 27, 2016 08:44
A Soft Delete concern
# Source by @Abs (http://stackoverflow.com/a/26855101)
module SoftDeletable
extend ActiveSupport::Concern
included do
default_scope { where(is_deleted: false) }
scope :only_deleted, -> { unscope(where: :is_deleted).where(is_deleted: true) }
end
def delete
@lenart
lenart / gist:039cfbd7e8f8cabd2391
Last active March 9, 2016 10:22
RSpec around filter for setting subdomain from example metadata
RSpec is absolutely flexible tool. One of its multitarget features is metadata. The main purpose of this feature is filtering and groupping examples by given attributes. You can found a lot of examples in article “Filtering examples in rspec-2”.
Recently I was faced with the need to test application behaviour depending on current subdomain. It was a group of examples so I need to use filters. Spec was similar to script below:
```ruby
feature "On custom subdomain", :subdomain => 'custom' do
scenario "homepage should change colorscheme to blue and use custom logo" do
...
end
@lenart
lenart / gist:fb31fcd2521d6f72760c
Last active November 18, 2015 12:58
Get production database from heroku and update it locally
# Using [parity](https://github.com/thoughtbot/parity)
development restore production
development restore staging
# Steps for manual backup
heroku pg:backups capture --remote production
curl `heroku pg:backups public-url --remote production` > tmp/db.dump
@lenart
lenart / 0_reuse_code.js
Last active August 29, 2015 14:13
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@lenart
lenart / application.rb
Created October 9, 2013 09:34
SilentLogger for Rails 4 to keep NewRelic's requests out of the production log.
# config/application.rb
require File.expand_path('../boot', __FILE__)
require 'rails/all'
require File.dirname(__FILE__) + '/../lib/silent_logger.rb'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(:default, Rails.env)