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 / user-photo.php
Created June 12, 2011 09:53
Make User Photo use a single profile picture accross wordpress network
<?php
/*
Plugin Name: User Photo
Plugin URI: http://wordpress.org/extend/plugins/user-photo/
Description: Allows users to associate photos with their accounts by accessing their "Your Profile" page. Uploaded images are resized to fit the dimensions specified on the options page; a thumbnail image is also generated. New template tags introduced are: <code>userphoto_the_author_photo</code>, <code>userphoto_the_author_thumbnail</code>, <code>userphoto_comment_author_photo</code>, and <code>userphoto_comment_author_thumbnail</code>. Uploaded images may be moderated by administrators.
Version: 0.9.5.1
Author: <a href="http://weston.ruter.net/">Weston Ruter</a>
Original code by Weston Ruter <http://weston.ruter.net> at Shepherd Interactive <http://shepherd-interactive.com>.
Continued development and maintenance by Dave Wagner (cptnwinky) <http://dev.dave-wagner.com/>
@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 / 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 / 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 / deploy.rb
Created September 25, 2013 18:44
Capistrano tasks to use with figaro gem.
namespace :figaro do
desc "SCP transfer figaro configuration to the shared folder"
task :setup do
transfer :up, "config/application.yml", "#{shared_path}/application.yml", via: :scp
end
desc "Symlink application.yml to the release path"
task :symlink do
run "ln -sf #{shared_path}/application.yml #{latest_release}/config/application.yml"
end
@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)