Lawrence  Lesch

Lawrence Lesch

1676293697

React-resume-template: React JS Resume Website Template

React JS Resume Website Template

React based template for software developer-focused resume websites

Description

This is a React based personal resume website template. Built with typescript on the Next.js framework, styled with Tailwind css, and populated with data from a single file, you can easily create, customize and host your own personal website in minutes. Even better, the site is fully mobile-optimized and server-side rendered to ensure fast loading and a clean UI on any device. Read on to learn how to make it your own.

Make it Your Own!

1. Make sure you have what you need

To build this website, you will need to have the latest stable versions of Node and Yarn downloaded and installed on your machine. If you don't already have them, you can get Node here, and Yarn here.

2. Fork and download this repo (and star if you like!)

Next, find the Fork button in the top right of this page. This will allow you to make your own copy, for more info on forking repo's see here. After this, download to your development machine using the green Code button at the top of the repo page.

3. Install dependencies and run

Once you have your own copy of this repo forked and downloaded, open the folder in your favorite terminal and run yarn install to install dependencies. Following this, run yarn dev to run the project. In your terminal you should be given the url of the running instance (usually http://localhost:3000 unless you have something else running).

4. Customize the data to make it your own

All of the data for the site is driven via a file at /src/data/data.tsx. This is where you'll find the existing content, and updating the values here will be reflected on the site. If you have the site running as described above, you should see these changes reflected on save. The data types for all of these items are given in the same folder in the dataDef.ts file. Example images can be found at src/images/ and are imported in the data file. To change, simply update these images using the same name and location, or add new images and update the imports.

5. Hook up contact form

Due to the variety of options available for contact form providers, I've hooked up the contact form only so far as handling inputs and state. Form submission and the actual sending of the email is open to your own implementation. My personal recommendation for email provider is Sendgrid.

6. Make any other changes you like

Of course, all of the code is there and nothing is hidden from you so if you would like to make any other styling/data changes, feel free!

7. Deploy to Vercel and enjoy your new Resume Website

Deploying your new site to Vercel is simple, and can be done by following their guide here. When you're all done and the build succeeds, you should be given a url for your live site, go there and you'll see your new personal resume website! Congratulations!


View a live demo here.

If this template has helped you and you'd like to support my work, feel free to ♥️ Sponsor the project

🎉 Version 2 is here! New features:

  1. Completely rebuilt with React and full typescript support
  2. Built on the Next.js framework for easy server side rendering/static generation, image optimization, api routes, and deployment
  3. Styled entirely with TailwindCss
  4. Re-organized data population file for customizing site.
  5. Significant improvement/modernization of all site sections

Looking for the old version? You can find it here.


Download Details:

Author: tbakerx
Source Code: https://github.com/tbakerx/react-resume-template 
License: MIT license

#typescript #javascript #react #resume #template #portfolio 

React-resume-template: React JS Resume Website Template
Hermann  Frami

Hermann Frami

1673077096

Personal-site: My personal website - built with React, React-Router

Personal Website

My personal website. An MIT licensed, simple, easily modifiable, statically-exportable React, Jamstack application that deploys automatically for free using github pages. Built using modern javascript, based on create-react-app with React-Router, SCSS, github actions, and many other useful technologies.

Adapting this Project

Building your own personal website from this project can take as little as 30 minutes. Follow the setup instructions below and review detailed notes and a checklist on adapting this project here. Please feel free to reach out to me by filing an issue or emailing me at help@mldangelo.com for help configuring your project.

Contributing

Contributions are actively encouraged. Please review the design goals, roadmap, and contributing guidelines. If you find a bug, please email me, submit a pull request (I'll buy you a coffee as a thank you), or submit an issue.

Dependencies

Tested with: node >= v14 and optional nvm for managing node versions.

Set up

To download the repository and install dependencies, run the following commands:

git clone git://github.com/mldangelo/personal-site.git # replace [mldangelo] with your github username if you fork first.
cd personal-site
nvm install # this is optional - make sure you're running >= node 14 with `node --version`
npm install

Running

Run the following command to build the react application and serve it with fast refresh:

npm start

Your web browser should automatically open to <ip>:<port>:<path> default: http://localhost:3000/.

Deploying

Deploying to Github Pages

  1. Modify the environmental variables and git remote url in .github/workflows/github-pages.yml.
  2. Modify homepage in package.json to point to where you plan to host your site. If you do not plan on using a custom domain name, it should look like https://[your-gh-username].github.io/[repository-name - default:personal-site]/
  3. If you plan on using a custom domain, modify public/CNAME. If you don't, delete public/CNAME.

Make a commit to main and push your changes. That's it.

Static Export

To statically export the site without deploying to github pages, delete or disable .github/workflows/github-pages.yml and run npm run predeploy. This generates a static export of the website as personal-site/build/. Copy this and self-host or deploy to a CDN.

Acknowledgements

See: mldangelo.com.

Download Details:

Author: mldangelo
Source Code: https://github.com/mldangelo/personal-site 
License: MIT license

#serverless #react #javascript #resume #portfolio 

Personal-site: My personal website - built with React, React-Router
Gordon  Matlala

Gordon Matlala

1667429580

Resume: A Minimalist Resume Template for Jekyll and Hexo

Resume

A Minimalist Resume Template for Jekyll and Hexo

Introduction

This is a responsive minimal résumé template made by Crisp, powered by Jekyll. And we also provide an official Hexo port for Hexo users.

You may config all the data in yaml and make it your own résumé. Then, you might use on GitHub Pages, your website, or wherever you want.

English 简体中文

DEMO

Features

  • Simple, elegant, and minimal design
  • PC and mobile friendly, but it looks better on PC
  • PDF supports and print friendly
  • Flexible and extensible

Usage

Local Mode

Clone the repo

git clone https://github.com/crispgm/resume.git

Install Jekyll

gem install jekyll

Config your résumé data

The baseurl is required in _config.yml if you serve this page as part of your website. And your contact information, EDUCATION, SKILLS, EXPERIENCE, and PROJECTS data will be set in _data/resume.yml.

Run and Debug

jekyll serve

Build

jekyll build

Gem-based Theme

Create a Gemfile

source "https://rubygems.org"

gem "jekyll-theme-minimal-resume"

And then,

bundle install

Init _config.yml

title: Résumé Title
baseurl: "/resume/"
theme: "jekyll-theme-minimal-resume"

Create a index.html

---
layout: resume
---

Create _data/resume.yml and fill in your resume data. Example data is available here.

Data Format

Contact

contact:
  - icon: fa-envelope
    text: youremail@example.com
  - icon: fa-phone-square
    text: your-phone-num
  - icon: fa-globe
    text: your-website.com
    link: https://crispgm.github.io/resume/resume.html

FontAwesome iconfont is embedded, so use the fa- class name as icon. link is optional, present if you want a link for your web version.

Colors

There are a set of colorscheme. color may be specified in _config.yml. The default colorscheme is gray.

color: gray

Colors powered by Open-Color:

  • red
  • pink
  • grape
  • violet
  • indigo
  • blue
  • cyan
  • teal
  • green
  • lime
  • yellow
  • orange

Colors powered by Nord:

  • nord

Extending Sections

Add new section in _data/resume.yml

languages:
  - name: English
    proficiency: Professional working proficiency
  - name: Mandarin Chinese
    proficiency: Native or bilingual proficiency

Add section to _layouts/resume.html:

<section id="languages">
  <div class="section-title">Language</div>
  <div class="section-content">
    {% for lang in site.data.resume.languages %}
    <div class="block">
      <div class="block-title">{{ lang.name }}</div>
      <div class="block-content">{{ lang.proficiency }}</div>
    </div>
    {% endfor %}
  </div>
</section>

Showcases

Feel free to add yours here.

Download Details:

Author: Crispgm
Source Code: https://github.com/crispgm/resume 
License: MIT license

#jekyll #resume #template #theme 

Resume: A Minimalist Resume Template for Jekyll and Hexo
Gordon  Matlala

Gordon Matlala

1667306061

Simple Jekyll Theme for A Minimal Resume Website

Jekyll Resume Theme


Screenshot

Quick Setup

  1. Install Jekyll: gem install jekyll bundler
  2. Fork this repository and clone your fork
  3. Edit _config.yml to personalize your site

Settings

You have to fill some informations on _config.yml to customize your site:

Site settings

description: A blog about lorem ipsum dolor sit amet
baseurl: "" # the subpath of your site, e.g. /blog/
url: "http://localhost:3000" # the base hostname & protocol for your site

User settings

username: Lorem Ipsum
user_description: Software Engineer at Lorem Ipsum Dolor
user_title: Mauricio Urraco
email: mauriurraco@gmail.com

Don't forget to change your URL before you deploy your site!

Color and Particle Customization

  • Color Customization
    • Edit the .sass variables
  • Particle Customization
    • Edit the json data in particle function in app.js
    • Refer to Particle.js for help

Content

You can (and should) edit the .html files for adding your own information, icons, working experience, social links or whatever you want to add. I.e.:

<a aria-label="My Github" target="_blank" href="https://github.com/murraco">
  <i class="icon fa fa-github-alt" aria-hidden="true"></i>
</a>

Running locally

In order to compile the assets and run Jekyll locally you need to follow those steps:

  1. Install Jekyll
  2. Run bundle install
  3. Run bundle exec jekyll build
  4. Start and http-server in the folder _site

Contribution

  • Report issues
  • Open pull request with improvements
  • Spread the word
  • Reach out to me directly at mauriurraco@gmail.com

Credits

Live demo at https://jekyll-theme-minimal-resume.netlify.com/

Download Details:

Author: Murraco
Source Code: https://github.com/murraco/jekyll-theme-minimal-resume 
License: MIT license

#jekyll #resume #theme #template 

Simple Jekyll Theme for A Minimal Resume Website
Gordon  Matlala

Gordon Matlala

1667294400

Resume-website: Website for JSON Resume

JSON Resume Website

Development

There are two ways to run this website, locally or inside a VM.

Locally

1. Clone repository

git clone https://github.com/jsonresume/resume-website.git

2. Install Jekyll

  • Install RVM
  • Install Ruby 2.7
  • bundle exec install

3. Run Jekyll

jekyll serve --watch

This will run the Jekyll server on port 4000 and watch for any file changes.

VM

Dependencies:

  • Vagrant
  • VirtualBox

Simply run:

vagrant up
vagrant ssh
jekyll serve

Then open http://localhost:4000/.

The initial provision will take some time.

Note: The --watch flag for Jekyll has issues inside the VM, see Stack Overflow and jekyll/jekyll#1763.

Deploying

This repository is auto built using GitHub/Jekyll and deployed to GitHub Pages automagically.

Pull requests should be made to the master branch.

Visit the website at https://jsonresume.org/

Download Details:

Author: jsonresume
Source Code: https://github.com/jsonresume/resume-website 
License: MIT license

#jekyll #json #resume #website 

Resume-website: Website for JSON Resume
Gordon  Matlala

Gordon Matlala

1666731300

Researcher: A Jekyll Based Resume Template

Researcher

A clean, single column, monospace resume template built for jekyll

Installation

Simply fork the repository and edit away.

Installation via remote themes

  • Just setting remote_theme: ankitsultana/researcher@gem in _config.yml should work. Although in that case, I am not sure how you would build your site locally for testing. If you know how, open up an issue and let me know.
  • For more info, refer this.

Customization

You can edit the .md (markdown) files as you see fit. You can also add some other markdown file, say foo.md in the root directory of the repository. It will then be accessible like so {{ url of your website }}/foo.

You can of course remove contact.md if you don't want it

To set the heading, edit the title variable in _config.yml

To edit the links mentioned on the navigation bar, you can edit _config.yml. For example:

nav:
 - name: "About"
   link: "/researcher/"
 - name: "Resume"
   link: "resume.pdf"
 - name: "Contact"
   link: "contact"

You can change the accent (color of hyperlinks) by editing the accent variable in _sass/vars.scss

You can setup google analytics, by setting tracking_id in _config.yml

To add a profile picture, make sure to give the image tag the class profile-picture. In other words,do it like so:

<img class="profile-picture" src="sherlock.jpg">

You can remove/customize the footer as you like by setting the appropriate variables in _config.yml

(New in v1.2.0) You can add institute logo at the top, by setting ins_logo in _config.yml. If you want to adjust the logo's size, try setting max-height in #ins-logo in file ./_sass/_style.scss to the desired value

Note: Customizing the accent color might cause merge conflicts if you later try to merge from bk2dcradle/researcher to fetch updates/patches etc. (applicable only if you have forked).

Demo Website

Download Details:

Author: Ankitsultana
Source Code: https://github.com/ankitsultana/researcher 
License: GPL-3.0 license

#jekyll #resume #template 

Researcher: A Jekyll Based Resume Template
Gordon  Matlala

Gordon Matlala

1665907920

Jalpc: A Flexible Jekyll Theme, 3 Steps to Build Your Website

Jalpc.

This is a simple, beautiful and swift theme for Jekyll. It's mobile first, fluidly responsive, and delightfully lightweight.

If you're completely new to Jekyll, I recommend checking out the documentation at http://jekyllrb.com or there's a tutorial by Smashing Magazine.

Blog

3 steps to setup this theme at your website!

Here is a document of how to setup this theme with 3 steps and a wiki of how to add posts. If you have any questions please ask me at GitHub Issues.

Features

Index page

The index page is seprated into several sections and they are located in _includes/sections,the configuration is in _data/landing.yml and section's detail configuration is in _data/*.yml.

_data/*.yml

These files are used to dynamically render pages, so you almost don't have to edit html files to change your own theme, besides you can use jekyll serve --watch to reload changes.

The following is mapping between yml files to sections.

  • landing.yml ==> index.html
  • index/language.yml ==> index.html
  • index/careers.yml ==> _includes/sections/career.html
  • index/skills.yml ==> _includes/sections/skills.html
  • index/projects.yml ==> _includes/sections/projects.html
  • index/links.yml ==> _includes/sections/links.html

This yml file is about blog page navbar

  • blog.yml ==> _includes/header.html

The following is mapping between yml files to donation

  • donation/donationlist.yml ==> blog/donate.html
  • donation/alipay.yml ==> blog/donate.html
  • donation/wechat_pay.yml ==> blog/donate.yml

Chart Skills

I use Chart.js to show skills, the type of skills' chart is radar, if you want to custom, please read document of Chart.js and edit _includes/sections/skills.html and _data/index/skills.yml.

Categories in blog page

In blog page, we categorize posts into several categories by url, all category pages use same template html file - _includes/category.html.

For example: URL is http://127.0.0.1:4000/python/. In _data/blog.yml, we define this category named Python, so in _includes/category.html we get this URL(/python/) and change it to my category(Python), then this page are posts about Python. The following code is about how to get url and display corresponding posts in _includes/category.html.

<div class="row">
    <div class="col-lg-12 text-center">
        <div class="navy-line"></div>
        {% assign category = page.url | remove:'/' | capitalize %}
        {% if category == 'Html' %}
        {% assign category = category | upcase %}
        {% endif %}
        <h1>{{ category }}</h1>
    </div>
</div>
<div class="wrapper wrapper-content  animated fadeInRight blog">
    <div class="row">
        <ul id="pag-itemContainer" style="list-style:none;">
            {% assign counter = 0 %}
            {% for post in site.categories[category] %}
            {% assign counter = counter | plus: 1 %}
            <li>

Pagination

The pagination in jekyll is not very perfect,so I use front-end web method,there is a blog about the method and you can refer to jPages.

Page views counter

Many third party page counter platforms are too slow,so I count my website page view myself,the javascript file is static/js/count.min.js (static/js/count.js),the backend API is written with flask on Vultr VPS, detail code please see ztool-backhend-mongo.

Multilingual Page

The landing page has multilingual support with the i18next plugin.

Languages are configured in the _data/index/language.yml file.

Not everyone needs this feature, so I make it very easy to remove it, just clear content in file _data/language.yml and folder static/locales/.

About how to custom multilingual page, please see wiki.

Web analytics

I use Google analytics and GrowingIO to do web analytics, you can choose either to realize it,just register a account and replace id in _config.yml.

Comment

I use Disqus to realize comment. You should set disqus_shortname and get public key and then, in _config.yml, edit the disqus value to enable Disqus.

Share

I use AddToAny to share my blog on other social network platform. You can go to this website to custom your share buttons and paste code at _includes/share.html.

share

Search engines

I use javascript to realize blog search,you can double click Ctrl or click the icon at lower right corner of the page,the detail you can got to this repository. Just use it.

search

Compress CSS and JS files

All CSS and JS files are compressed at /static/assets.

I use UglifyJS2, clean-css to compress CSS and JS files, customised CSS files are at _sass folder which is feature of Jekyll. If you want to custom CSS and JS files, you need to do the following:

  1. Install NPM then install UglifyJS2 and clean-css: npm install -g uglifyjs; npm install -g clean-css, then run npm install at root dir of project.
  2. Compress script is build.js
  3. If you want to add or remove CSS/JS files, just edit build/build.js and build/files.conf.js, then run npm run build at root dir of project, link/src files will use new files.

OR

Edit CSS files at _sass folder.

Local tests/development

First, install Jekyll on terminal:

bundle install

Then, execute:

bundle exec jekyll serve

Put in a Jalpc Plug

If you want to give credit to the Jalpc theme with a link to my personal website http://www.jarrekk.com, that'd be awesome. No worries if you don't.

Upgrading Jalpc

Jalpc is always being improved by its users, so sometimes one may need to upgrade.

Ensure there's an upstream remote

If git remote -v doesn't have an upstream listed, you can do the following to add it:

git remote add upstream https://github.com/jarrekk/Jalpc.git

Pull in the latest changes

git pull upstream gh-pages

There may be merge conflicts, so be sure to fix the files that git lists if they occur. That's it!

Testing Locally

To test your site locally, you’ll need

Installing ruby

There are lots of different ways to install ruby.

In Mac OS X, older versions of ruby will already be installed. But I use the Ruby Version Manager (RVM) to have a more recent version. You could also use Homebrew.

In Windows, use RubyInstaller. (In most of this tutorial, I’ve assumed you’re using a Mac or some flavor of Unix. It’s possible that none of this was usable for Windows folks. Sorry!)

Installing the github-pages gem

Run the following command:

gem install github-pages

This will install the github-pages gem and all dependencies (including jekyll).

Later, to update the gem, type:

gem update github-pages

Testing your site locally To construct and test your site locally, go into the directory and type

jekyll build

This will create (or modify) a _site/ directory, containing everything from assets/, and then the index.md and all pages/*.md files, converted to html. (So there’ll be _site/index.html and the various _site/pages/*.html.)

Type the following in order to “serve” the site. This will first run build, and so it does not need to be preceded by jekyll build.

jekyll serve

Now open your browser and go to http://localhost:4000/site-name/

Todo

  •  jekyll server --watch mode need to use original CSS/JS files
  •  User can customise index page's section title.
  •  Non-github projects also have links.
  •  Add some custom color themes for selection(Nav bar, background, words, dominant hue).

Wiki

Ad

Jalpc-A: another Jekyll theme written by AngularJS.


https://jarrekk.github.io/Jalpc/

http://www.jarrekk.com -- Personal website


Download Details:

Author: jarrekk
Source Code: https://github.com/jarrekk/Jalpc 
License: MIT license

#jekyll #blog #resume #template #theme 

Jalpc: A Flexible Jekyll Theme, 3 Steps to Build Your Website
Gordon  Matlala

Gordon Matlala

1665895920

Hydejack: A Boutique Jekyll Theme for Hackers, Nerds, and Academics

Hydejack

A boutique Jekyll theme for hackers, nerds, and academics.

Screenshot

Hydejack's cover page on a variety of screens.

Hydejack is a boutique Jekyll theme for hackers, nerds, and academics, with a focus on personal sites that are meant to impress.

It includes a blog that is suitable for both prose and technical documentation, a portfolio to showcase your projects, and a resume template that looks amazing on the web and in print.

Your complete presence on the web — A blog, portfolio, and resume.

A Personal Site That Won't Disappear

Hydejack is 100% built on Open Source software, and is Open Source itself, save for parts of the PRO version. The PRO version is a one-time payment that gives you the right to use it forever.

Hydejack is all static sites. HTML. All you need is a web server --- any web server --- to have a professional web presence that lasts a lifetime.

Download

There are two versions of Hydejack: The Free Version includes basic blogging functionality and most of Hydejack's Features, such as dynamic page loading and advanced animations.

The PRO Version includes additional features for professionals, such as a portfolio, resume, Dark Mode, Forms, Built-In Search and customizable cookie banners.

The table below shows what's included in each version:

 FreePRO
[Blog]
[Features]
[Documentation][docs]
[Portfolio] 
Printable [Resume] 
[Dark Mode][dark] 
[Built-In Search][search] 
[Custom Forms][forms] 
[Newsletter Box][news] 
[Grid layout][grid] 
[Offline Support][ofln] 
Table of Contents[^2] 
Cookie Banner 
No Hydejack Branding 
License[GPL-3.0][lic][PRO]
Source[GitHub][src]Included
Price / UpgradeFree$99 / $39 [^3]
 [Download][kit] 
-- or --
[Deploy to Netlify][nfy]
[Buy PRO][buy]

Hydejack started out as a free blogging theme for Jekyll — and continues to be so.

An Impressive Portfolio

A portfolio that's guaranteed to be impressive — no matter what you put into it.

A Printable Resume

Get a resume that's consistent across the board — whether it's on the web, mobile, print, or PDF.

Resume PDF

Front and center page of a print resume generated by Hydejack.

Just Markdown

Write all content with Markdown. Hydejack gives you additional CSS classes to stylize your content, without losing compatibility with other Jekyll themes.

Just Markup

Hydejack boasts a plethora of modern JavaScript, but make no mistake: It's still a plain old web page at its core. It works without JavaScript and you can even view it in a text-based browser like w3m:

w3m Screenshot

The Hydejack blog, as seen by the text browser w3m.

Syntax Highlighting

Hydejack features syntax highlighting, powered by Rouge.

// file: `example.js`
document.querySelector("hy-push-state").addEventListener("hy-push-state-load", () => {
  const supportsCodeHighlights = true; //!!
});

Code blocks can have a filename and a caption.

Beautiful Math

They say math is beautiful — and with Hydejack's math support it's guaranteed to also look beautiful:

Math example

Hydejack uses KaTeX to efficiently render math.

Build an Audience

The PRO version has built-in support for customizable Tinyletter newsletter subscription boxes.

If you are using a different service like MailChimp, you can build a custom newsletter subscription box using Custom Forms.

Features

An incomplete list of features included in all versions of Hydejack:

  • Responsive layout with unique design features for every screen size
  • Cover Pages for a stunning fist impression.
  • Customizable sidebar and touch-enabled drawer menu
  • Single Page Web App-style page loading
  • Advanced FLIP animations, inspired by Material Design
  • Good Google PageSpeed Score[^1]
  • Syntax highlighting, powered by Rouge
  • LaTeX math blocks, rendered with ether KaTeX or MathJax at your choice
  • Soft-coded labels: Change wording or translate to other languages via a single file
  • Support for categories and tags
  • Author section below each article and support for multiple authors
  • Built-in icons for many social networks
  • Simple and semantic HTML + Structured Data
  • Google Analytics and Google Fonts support

Comparison

There are two versions of Hydejack: The Free Version includes basic blogging functionality and most of Hydejack's Features, such as dynamic page loading and advanced animations.

The PRO Version includes additional features for professionals, such as a portfolio, resume, Dark Mode, Forms, Built-In Search and customizable cookie banners.

The table below shows what's included in each version:

 FreePRO
[Blog]
[Features]
[Documentation][docs]
[Portfolio] 
Printable [Resume] 
[Dark Mode][dark] 
[Built-In Search][search] 
[Custom Forms][forms] 
[Newsletter Box][news] 
[Grid layout][grid] 
[Offline Support][ofln] 
Table of Contents[^2] 
Cookie Banner 
No Hydejack Branding 
License[GPL-3.0][lic][PRO]
Source[GitHub][src]Included
Price / UpgradeFree$99 / $39 [^3]
 [Download][kit] 
-- or --
[Deploy to Netlify][nfy]
[Buy PRO][buy]

[^1]: Actual page load speed depends on your hosting provider, resolution of embedded images and usage of 3rd party plugins.

[^2]: Large screens (> 1664px width) only.

[^3]: Upgrading from Hydejack 8? Find your discount code in the latest zip download!

*[FLIP]: First-Last-Invert-Play. A coding technique to achieve performant page transition animations.

Download Details:

Author: Hydecorp
Source Code: https://github.com/hydecorp/hydejack 
License: View license

#jekyll #resume #template #theme 

Hydejack: A Boutique Jekyll Theme for Hackers, Nerds, and Academics
Gordon  Matlala

Gordon Matlala

1665875940

Modern-resume-theme: A Modern Static Resume Template and Theme

Modern-resume-theme 

A modern simple static resume template and theme. Powered by Jekyll and GitHub pages.
Host your own resume on GitHub for free!

View Demo


Installation & setup guide

This template is designed to be hosted using GitHub pages and so that's what these instructions will cover. If you plan on hosting it seperately then there might be some extra steps that we wont cover.

Before starting it might be useful to familiarise yourself with Jekyll, Markdown and GitHub pages.

Step 1 - GitHub

Start by creating an account on GitHub

Step 2 - Create Repository

Create a repository on GitHub to hold your files and host your resume. You can find out how to do that here

Step 3 - Download Resume Template

Download and extract the following zip into the git repository you have just created. resume-template.zip

Step 4 - Push it

Commit and push the resume template to github

$ git add --all
$ git commit -m "Initial resume setup"
$ git push -u origin master

Step 5 - See it

You should now be able to see the demo resume template using this theme at [your-username].github.io


Usage

So now you will be able to see the demo template at your github URL. You can can edit the yml files and replace the demo content with your own. Hopefully it will be fairly simple to work out where all the content goes, but here is a quick overview.

_config.yml

This will contain all the of the main configuration for your resume such as your name, email, social media links and about me content. It also contains all the content for your resume.
A full example of the _config.yml can be found here

Content

The main content for you resume will all come under the content property in the _config.yml file. This can be quite complex and a good understanding on YAML will be helpful here.

Content will contain an array of sections, there are currently 2 types of layouts for content sections, text and list.

text is a basic layout that contains markdown content.
list is a the standard layout that is used for things like Education and Experience.

Below is a the full list of content options.

content:
  - title: Section Name
    layout: list (options: list, text)
    content:
      - layout: left (options: left, right, top, top-right, top-middle)(default: left)
        title: Name of item (eg. Company or Project name)
        sub_title: Sub title (eg. Qualification or Job title)(optional)
        caption: Item caption (eg. Employment or course dates)(optional)
        link: Web link (eg. https://sproogen.github.io/modern-resume-theme)(optional)
        link_text: Text for link (optional: without this link will show URL as link text)
        additional_links: (optional)
          - title: Link name
            icon: Font Awesome brand icon name (eg. fab fa-twitter) (https://fontawesome.com/icons?d=gallery&s=brands&m=free)
            url: Link url (eg. https://google.com)
        quote: >
          Short overview or quote for the item
        description: | # this will include new lines to allow paragraphs
          Main content area for the list item.
  - title: Section Name
    layout: text (options: list, text)
    content: | # this will include new lines to allow paragraphs
      This is where you can write a little more about yourself. You could title this section **Interests** and include some of your other interests.

      Or you could title it **Skills** and write a bit more about things that make you more desirable, like *leadership* or *teamwork*

Note: The description or content areas (fields starting with | #) use markdown, this means that you have the ability to format the section in many different ways and add things such as images, code & syntax highlighting and tables. You can find a good Markdown cheatsheet here

Additional links

If you would like to add more than the predefined social links in the config file, then you can use the additional_links field to add as many additional links with urls and font awesome icons as you wish.

Dark Mode

Dark mode is configured via _config.yml

darkmode: true (options: true, false, never)

When dark mode is true the site will show the dark theme for everyone
When dark mode is false the site will not show the dark theme, but it will still respect the users device preferences
When dark mode is never the site will never be shown in the dark theme

Heading Anchors

You can link to section titles using a Markdown anchor link, e.g.: [About me](#about-me). The link after the # is the slug version of the title.

assets/main.scss

Add any css changes or additions you want to make here after the line @import 'modern-resume-theme';


Running locally

Before you start make sure you have Ruby and the gems for Jekyll installed locally. You can find out how to do that here.

  1. Clone your resume repository locally (if you haven't already)
  2. cd [your-repository-name]
  3. bundle install
  4. bundle exec jekyll serve
  5. Open your browser to http://localhost:4000

Any changes you make will automatically build and you will be able to see these by refreshing your browser.

Note: You will need to re-run bundle exec jekyll serve to see changes made in _config.yml.


Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/sproogen/modern-resume-theme. You can view our full guide to contributing here This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.


Development

Locally

Before you start make sure you have Ruby and the gems for Jekyll installed locally. You can find out how to do that here.

Note: You will need version 1.15.2 of bundler, as this is the only version that Heroku supports.

  1. Fork and or clone this repository locally
  2. cd modern-resume-theme
  3. bundle install
  4. bundle exec jekyll serve
  5. Open your browser to http://localhost:4000

Any changes you make will automatically build and you will be able to see these by refreshing your browser. To find out more about Jekyll take a look here.

Note: You will need to re-run bundle exec jekyll serve to see changes made in _config.yml.

Docker

If you have docker installed you can simply run docker-compose up to launch the site in a container, it will then be hosted at http://localhost:4000


Announcements

Nov 2020 - Content configuration version 2 released. Added a new more configurable way of adding data to the resume. Add as many content sections as you like in what ever order you want. Currently just text and list but future categories coming soon. Full backwards compatibilty with version 1 remains and the documentation for version 1 can be found here (Version 1 Readme).

Dec 2019 - Now includes Dark Mode


img

Thank you for checking out my resume theme / template. If you have any feedback or suggestions for things I can add please let me know by by raising an issue, I'm always happy to help.

I always enjoy seeing how people are using my creations and if you would like to say thanks feel free to buy me a coffee (buymeacoffee.com/vJ6HfLu).

If you would like to see how I am using this then you can view my resume here (jameswgrant.co.uk) and find the code here (sproogen/jameswgrant), hopefully this might help you.

You can view the project roadmap here.


Download Details:

Author: Sproogen
Source Code: https://github.com/sproogen/modern-resume-theme 
License: MIT license

#jekyll #resume #template #theme 

Modern-resume-theme: A Modern Static Resume Template and Theme
Gordon  Matlala

Gordon Matlala

1665872040

A Simple Jekyll + GitHub Pages Powered Resume Template

Resume template

A simple Jekyll + GitHub Pages powered resume template.

Docs

Running locally

To test locally, run the following in your terminal:

  1. Clone repo locally
  2. bundle install
  3. bundle exec jekyll serve
  4. Open your browser to localhost:4000

Running locally with Docker

To test locally with docker, run the following in your terminal after installing docker into your system:

  1. docker image build -t resume-template .
  2. docker run --rm --name resume-template -v "$PWD":/home/app --network host resume-template

Customizing

First you'll want to fork the repo to your own account. Then clone it locally and customize, or use the GitHub web editor to customize.

Options/configuration

Most of the basic customization will take place in the /_config.yml file. Here is a list of customizations available via /_config.yml:

[...write these out...]

Editing content

Most of the content configuration will take place in the /_layouts/resume.html file. Simply edit the markup there accordingly

Publishing to GitHub Pages for free

GitHub Pages will host this for free with your GitHub account. Just make sure you're using a gh-pages branch, and the site will automatically be available at yourusername.github.io/resume-template (you can rename the repo to resume for your own use if you want it to be available at yourusername.github.io/resume). You can also add a CNAME if you want it to be available at a custom domain...

Configuring with your own domain name

To setup your GH Pages site with a custom domain, follow the instructions on the GitHub Help site for that topic.

Themes

Right now resume-template only has one theme. More are coming :soon: though. :heart:

Roadmap

A feature roadmap is available here. If you features suggestions, please open a new issue.

Contributing

If you spot a bug, or want to improve the code, or even make the dummy content better, you can do the following:

  1. Open an issue describing the bug or feature idea
  2. Fork the project, make changes, and submit a pull request

Download Details:

Author: jglovier
Source Code: https://github.com/jglovier/resume-template 
License: MIT license

#jekyll #resume #template #html #css 

A Simple Jekyll + GitHub Pages Powered Resume Template
Gordon  Matlala

Gordon Matlala

1665855180

Online-cv: A Minimal Jekyll Theme to Host Your Resume (CV)

Orbit

This theme is designed by Xiaoying Riley at 3rd Wave Media. Visit her website for more themes.

I have made this into a Jekyll Theme. Checkout the live demo here.

DesktopMobile

Installation

  • Fork the repository
  • Go to settings and set master branch as Github Pages source.
  • Your new site should be ready at https://<username>.github.io/online-cv/
  • Printable version of the site can be found at https://<username>.github.io/online-cv/print. Use a third party link https://pdflayer.com/, https://www.web2pdfconvert.com/ etc to get the printable PDF.

Change all the details from one place: _data/data.yml

To preview/edit localy with docker

docker-compose up

docker-compose.yml file is used to create a container that is reachable under http://localhost:4000. Changes _data/data.yml will be visible after a while.

Skins

There are 6 color schemes available:

BlueTurquoiseGreen
BerryOrangeCeramic

Credits

Thanks to Nelson Estevão for all the contributions.

Thanks to t-h-e(sfrost) for all the contributions.

Check out for more themes: Jekyll Themes.

Star History

Star History Chart

Download Details:

Author: Sharu725
Source Code: https://github.com/sharu725/online-cv 

#jekyll #resume #template #theme 

Online-cv: A Minimal Jekyll Theme to Host Your Resume (CV)
Gordon  Taylor

Gordon Taylor

1660670640

Resume-cli: CLI tool To Easily Setup A New Resume

resume-cli

This is the command line tool for JSON Resume, the open source initiative to create a JSON-based standard for resumes.

Read more...

Alternatives: The Resume CLI tool works as it is so there isn't a huge amount of active development on it, try these alternatives if it doesn't work for you;

Getting Started

Install the command-line tool:

npm install -g resume-cli

Commands at a glance

commanddescription
initInitialize a resume.json file
validateSchema validation test your resume.json
export [fileName.html]Export locally to .html
serveServe resume at http://localhost:4000/

Usage

resume --help

Show a list of options and commands for the CLI.

resume init

Creates a new resume.json file in your current working directory.

Complete the resume.json with your text editor. Be sure to follow the schema (available at http://jsonresume.org).

resume validate

Validates your resume.json against our schema tests to ensure it complies with the standard. Tries to identify where any errors may be occurring.

resume export [fileName]

Exports your resume locally in a stylized HTML or PDF format.

A list of available themes can be found here: http://jsonresume.org/themes/

Please npm install the theme you wish to use locally before attempting to export it.

Options:

  • --format <file type> Example: --format pdf
  • --theme <name> Example: --theme even

resume serve

Starts a web server that serves your local resume.json. It will live reload when you make edits to your resume.json.

Options:

  • --port <port>
  • --theme <name>

When developing themes, simply change into your theme directory and run resume serve --theme . (which tells it to run the local folder as the specified theme)

supported resume input types

  • json: via JSON.parse.
  • yaml: via yaml-js
  • quaff: if --resume is a directory, then the path is passed to quaff and the resulting json is used as the resume. quaff supports a variety of formats in the directory, including javascript modules.

resume data

  • Setting --resume - tells the cli to read resume data from standard input (stdin), and defaults --type to application/json.
  • Setting --resume <path> reads resume data from path.
  • Leaving --resume unset defaults to reading from resume.json on the current working directory.

resume mime types

Supported resume data mime types are:

  • application/json
  • text/yaml

Development

to test the cli, run the dev script:

npm run dev -- [cli arguments can be passed after the double-dash]

Download Details:

Author: jsonresume
Source Code: https://github.com/jsonresume/resume-cli 
License: MIT license

#javascript #cli #resume 

Resume-cli: CLI tool To Easily Setup A New Resume

Rufus Scheduler: Job Scheduler for Ruby (at, Cron, in and Every Jobs)

rufus-scheduler

Job scheduler for Ruby (at, cron, in and every jobs).

It uses threads.

Note: maybe are you looking for the README of rufus-scheduler 2.x? (especially if you're using Dashing which is stuck on rufus-scheduler 2.0.24)

Quickstart:

# quickstart.rb

require 'rufus-scheduler'

scheduler = Rufus::Scheduler.new

scheduler.in '3s' do
  puts 'Hello... Rufus'
end

scheduler.join
  #
  # let the current thread join the scheduler thread
  #
  # (please note that this join should be removed when scheduling
  # in a web application (Rails and friends) initializer)

(run with ruby quickstart.rb)

Various forms of scheduling are supported:

require 'rufus-scheduler'

scheduler = Rufus::Scheduler.new

# ...

scheduler.in '10d' do
  # do something in 10 days
end

scheduler.at '2030/12/12 23:30:00' do
  # do something at a given point in time
end

scheduler.every '3h' do
  # do something every 3 hours
end
scheduler.every '3h10m' do
  # do something every 3 hours and 10 minutes
end

scheduler.cron '5 0 * * *' do
  # do something every day, five minutes after midnight
  # (see "man 5 crontab" in your terminal)
end

# ...

Rufus-scheduler uses fugit for parsing time strings, et-orbi for pairing time and tzinfo timezones.

non-features

Rufus-scheduler (out of the box) is an in-process, in-memory scheduler. It uses threads.

It does not persist your schedules. When the process is gone and the scheduler instance with it, the schedules are gone.

A rufus-scheduler instance will go on scheduling while it is present among the objects in a Ruby process. To make it stop scheduling you have to call its #shutdown method.

related and similar gems

  • Whenever - let cron call back your Ruby code, trusted and reliable cron drives your schedule
  • ruby-clock - a clock process / job scheduler for Ruby
  • Clockwork - rufus-scheduler inspired gem
  • Crono - an in-Rails cron scheduler
  • PerfectSched - highly available distributed cron built on Sequel and more

(please note: rufus-scheduler is not a cron replacement)

note about the 3.0 line

It's a complete rewrite of rufus-scheduler.

There is no EventMachine-based scheduler anymore.

I don't know what this Ruby thing is, where are my Rails?

I'll drive you right to the tracks.

notable changes:

  • As said, no more EventMachine-based scheduler
  • scheduler.every('100') { will schedule every 100 seconds (previously, it would have been 0.1s). This aligns rufus-scheduler with Ruby's sleep(100)
  • The scheduler isn't catching the whole of Exception anymore, only StandardError
  • The error_handler is #on_error (instead of #on_exception), by default it now prints the details of the error to $stderr (used to be $stdout)
  • Rufus::Scheduler::TimeOutError renamed to Rufus::Scheduler::TimeoutError
  • Introduction of "interval" jobs. Whereas "every" jobs are like "every 10 minutes, do this", interval jobs are like "do that, then wait for 10 minutes, then do that again, and so on"
  • Introduction of a lockfile: true/filename mechanism to prevent multiple schedulers from executing
  • "discard_past" is on by default. If the scheduler (its host) sleeps for 1 hour and a every '10m' job is on, it will trigger once at wakeup, not 6 times (discard_past was false by default in rufus-scheduler 2.x). No intention to re-introduce discard_past: false in 3.0 for now.
  • Introduction of Scheduler #on_pre_trigger and #on_post_trigger callback points

getting help

So you need help. People can help you, but first help them help you, and don't waste their time. Provide a complete description of the issue. If it works on A but not on B and others have to ask you: "so what is different between A and B" you are wasting everyone's time.

"hello", "please" and "thanks" are not swear words.

Go read how to report bugs effectively, twice.

Update: help_help.md might help help you.

on Gitter

You can find help via chat over at https://gitter.im/floraison/fugit. It's fugit, et-orbi, and rufus-scheduler combined chat room.

Please be courteous.

issues

Yes, issues can be reported in rufus-scheduler issues, I'd actually prefer bugs in there. If there is nothing wrong with rufus-scheduler, a Stack Overflow question is better.

faq

scheduling

Rufus-scheduler supports five kinds of jobs. in, at, every, interval and cron jobs.

Most of the rufus-scheduler examples show block scheduling, but it's also OK to schedule handler instances or handler classes.

in, at, every, interval, cron

In and at jobs trigger once.

require 'rufus-scheduler'

scheduler = Rufus::Scheduler.new

scheduler.in '10d' do
  puts "10 days reminder for review X!"
end

scheduler.at '2014/12/24 2000' do
  puts "merry xmas!"
end

In jobs are scheduled with a time interval, they trigger after that time elapsed. At jobs are scheduled with a point in time, they trigger when that point in time is reached (better to choose a point in the future).

Every, interval and cron jobs trigger repeatedly.

require 'rufus-scheduler'

scheduler = Rufus::Scheduler.new

scheduler.every '3h' do
  puts "change the oil filter!"
end

scheduler.interval '2h' do
  puts "thinking..."
  puts sleep(rand * 1000)
  puts "thought."
end

scheduler.cron '00 09 * * *' do
  puts "it's 9am! good morning!"
end

Every jobs try hard to trigger following the frequency they were scheduled with.

Interval jobs trigger, execute and then trigger again after the interval elapsed. (every jobs time between trigger times, interval jobs time between trigger termination and the next trigger start).

Cron jobs are based on the venerable cron utility (man 5 crontab). They trigger following a pattern given in (almost) the same language cron uses.

 

#schedule_x vs #x

schedule_in, schedule_at, schedule_cron, etc will return the new Job instance.

in, at, cron will return the new Job instance's id (a String).

job_id =
  scheduler.in '10d' do
    # ...
  end
job = scheduler.job(job_id)

# versus

job =
  scheduler.schedule_in '10d' do
    # ...
  end

# also

job =
  scheduler.in '10d', job: true do
    # ...
  end

#schedule and #repeat

Sometimes it pays to be less verbose.

The #schedule methods schedules an at, in or cron job. It just decides based on its input. It returns the Job instance.

scheduler.schedule '10d' do; end.class
  # => Rufus::Scheduler::InJob

scheduler.schedule '2013/12/12 12:30' do; end.class
  # => Rufus::Scheduler::AtJob

scheduler.schedule '* * * * *' do; end.class
  # => Rufus::Scheduler::CronJob

The #repeat method schedules and returns an EveryJob or a CronJob.

scheduler.repeat '10d' do; end.class
  # => Rufus::Scheduler::EveryJob

scheduler.repeat '* * * * *' do; end.class
  # => Rufus::Scheduler::CronJob

(Yes, no combination here gives back an IntervalJob).

schedule blocks arguments (job, time)

A schedule block may be given 0, 1 or 2 arguments.

The first argument is "job", it's simply the Job instance involved. It might be useful if the job is to be unscheduled for some reason.

scheduler.every '10m' do |job|

  status = determine_pie_status

  if status == 'burnt' || status == 'cooked'
    stop_oven
    takeout_pie
    job.unschedule
  end
end

The second argument is "time", it's the time when the job got cleared for triggering (not Time.now).

Note that time is the time when the job got cleared for triggering. If there are mutexes involved, now = mutex_wait_time + time...

"every" jobs and changing the next_time in-flight

It's OK to change the next_time of an every job in-flight:

scheduler.every '10m' do |job|

  # ...

  status = determine_pie_status

  job.next_time = Time.now + 30 * 60 if status == 'burnt'
    #
    # if burnt, wait 30 minutes for the oven to cool a bit
end

It should work as well with cron jobs, not so with interval jobs whose next_time is computed after their block ends its current run.

scheduling handler instances

It's OK to pass any object, as long as it responds to #call(), when scheduling:

class Handler
  def self.call(job, time)
    p "- Handler called for #{job.id} at #{time}"
  end
end

scheduler.in '10d', Handler

# or

class OtherHandler
  def initialize(name)
    @name = name
  end
  def call(job, time)
    p "* #{time} - Handler #{name.inspect} called for #{job.id}"
  end
end

oh = OtherHandler.new('Doe')

scheduler.every '10m', oh
scheduler.in '3d5m', oh

The call method must accept 2 (job, time), 1 (job) or 0 arguments.

Note that time is the time when the job got cleared for triggering. If there are mutexes involved, now = mutex_wait_time + time...

scheduling handler classes

One can pass a handler class to rufus-scheduler when scheduling. Rufus will instantiate it and that instance will be available via job#handler.

class MyHandler
  attr_reader :count
  def initialize
    @count = 0
  end
  def call(job)
    @count += 1
    puts ". #{self.class} called at #{Time.now} (#{@count})"
  end
end

job = scheduler.schedule_every '35m', MyHandler

job.handler
  # => #<MyHandler:0x000000021034f0>
job.handler.count
  # => 0

If you want to keep that "block feeling":

job_id =
  scheduler.every '10m', Class.new do
    def call(job)
      puts ". hello #{self.inspect} at #{Time.now}"
    end
  end

pause and resume the scheduler

The scheduler can be paused via the #pause and #resume methods. One can determine if the scheduler is currently paused by calling #paused?.

While paused, the scheduler still accepts schedules, but no schedule will get triggered as long as #resume isn't called.

job options

name: string

Sets the name of the job.

scheduler.cron '*/15 8 * * *', name: 'Robert' do |job|
  puts "A, it's #{Time.now} and my name is #{job.name}"
end

job1 =
  scheduler.schedule_cron '*/30 9 * * *', n: 'temporary' do |job|
    puts "B, it's #{Time.now} and my name is #{job.name}"
  end
# ...
job1.name = 'Beowulf'

blocking: true

By default, jobs are triggered in their own, new threads. When blocking: true, the job is triggered in the scheduler thread (a new thread is not created). Yes, while a blocking job is running, the scheduler is not scheduling.

overlap: false

Since, by default, jobs are triggered in their own new threads, job instances might overlap. For example, a job that takes 10 minutes and is scheduled every 7 minutes will have overlaps.

To prevent overlap, one can set overlap: false. Such a job will not trigger if one of its instances is already running.

The :overlap option is considered before the :mutex option when the scheduler is reviewing jobs for triggering.

mutex: mutex_instance / mutex_name / array of mutexes

When a job with a mutex triggers, the job's block is executed with the mutex around it, preventing other jobs with the same mutex from entering (it makes the other jobs wait until it exits the mutex).

This is different from overlap: false, which is, first, limited to instances of the same job, and, second, doesn't make the incoming job instance block/wait but give up.

:mutex accepts a mutex instance or a mutex name (String). It also accept an array of mutex names / mutex instances. It allows for complex relations between jobs.

Array of mutexes: original idea and implementation by Rainux Luo

Note: creating lots of different mutexes is OK. Rufus-scheduler will place them in its Scheduler#mutexes hash... And they won't get garbage collected.

The :overlap option is considered before the :mutex option when the scheduler is reviewing jobs for triggering.

timeout: duration or point in time

It's OK to specify a timeout when scheduling some work. After the time specified, it gets interrupted via a Rufus::Scheduler::TimeoutError.

scheduler.in '10d', timeout: '1d' do
  begin
    # ... do something
  rescue Rufus::Scheduler::TimeoutError
    # ... that something got interrupted after 1 day
  end
end

The :timeout option accepts either a duration (like "1d" or "2w3d") or a point in time (like "2013/12/12 12:00").

:first_at, :first_in, :first, :first_time

This option is for repeat jobs (cron / every) only.

It's used to specify the first time after which the repeat job should trigger for the first time.

In the case of an "every" job, this will be the first time (modulo the scheduler frequency) the job triggers. For a "cron" job as well, the :first will point to the first time the job has to trigger, the following trigger times are then determined by the cron string.

scheduler.every '2d', first_at: Time.now + 10 * 3600 do
  # ... every two days, but start in 10 hours
end

scheduler.every '2d', first_in: '10h' do
  # ... every two days, but start in 10 hours
end

scheduler.cron '00 14 * * *', first_in: '3d' do
  # ... every day at 14h00, but start after 3 * 24 hours
end

:first, :first_at and :first_in all accept a point in time or a duration (number or time string). Use the symbol you think makes your schedule more readable.

Note: it's OK to change the first_at (a Time instance) directly:

job.first_at = Time.now + 10
job.first_at = Rufus::Scheduler.parse('2029-12-12')

The first argument (in all its flavours) accepts a :now or :immediately value. That schedules the first occurrence for immediate triggering. Consider:

require 'rufus-scheduler'

s = Rufus::Scheduler.new

n = Time.now; p [ :scheduled_at, n, n.to_f ]

s.every '3s', first: :now do
  n = Time.now; p [ :in, n, n.to_f ]
end

s.join

that'll output something like:

[:scheduled_at, 2014-01-22 22:21:21 +0900, 1390396881.344438]
[:in, 2014-01-22 22:21:21 +0900, 1390396881.6453865]
[:in, 2014-01-22 22:21:24 +0900, 1390396884.648807]
[:in, 2014-01-22 22:21:27 +0900, 1390396887.651686]
[:in, 2014-01-22 22:21:30 +0900, 1390396890.6571937]
...

:last_at, :last_in, :last

This option is for repeat jobs (cron / every) only.

It indicates the point in time after which the job should unschedule itself.

scheduler.cron '5 23 * * *', last_in: '10d' do
  # ... do something every evening at 23:05 for 10 days
end

scheduler.every '10m', last_at: Time.now + 10 * 3600 do
  # ... do something every 10 minutes for 10 hours
end

scheduler.every '10m', last_in: 10 * 3600 do
  # ... do something every 10 minutes for 10 hours
end

:last, :last_at and :last_in all accept a point in time or a duration (number or time string). Use the symbol you think makes your schedule more readable.

Note: it's OK to change the last_at (nil or a Time instance) directly:

job.last_at = nil
  # remove the "last" bound

job.last_at = Rufus::Scheduler.parse('2029-12-12')
  # set the last bound

times: nb of times (before auto-unscheduling)

One can tell how many times a repeat job (CronJob or EveryJob) is to execute before unscheduling by itself.

scheduler.every '2d', times: 10 do
  # ... do something every two days, but not more than 10 times
end

scheduler.cron '0 23 * * *', times: 31 do
  # ... do something every day at 23:00 but do it no more than 31 times
end

It's OK to assign nil to :times to make sure the repeat job is not limited. It's useful when the :times is determined at scheduling time.

scheduler.cron '0 23 * * *', times: (nolimit ? nil : 10) do
  # ...
end

The value set by :times is accessible in the job. It can be modified anytime.

job =
  scheduler.cron '0 23 * * *' do
    # ...
  end

# later on...

job.times = 10
  # 10 days and it will be over

Job methods

When calling a schedule method, the id (String) of the job is returned. Longer schedule methods return Job instances directly. Calling the shorter schedule methods with the job: true also returns Job instances instead of Job ids (Strings).

  require 'rufus-scheduler'

  scheduler = Rufus::Scheduler.new

  job_id =
    scheduler.in '10d' do
      # ...
    end

  job =
    scheduler.schedule_in '1w' do
      # ...
    end

  job =
    scheduler.in '1w', job: true do
      # ...
    end

Those Job instances have a few interesting methods / properties:

id, job_id

Returns the job id.

job = scheduler.schedule_in('10d') do; end
job.id
  # => "in_1374072446.8923042_0.0_0"

scheduler

Returns the scheduler instance itself.

opts

Returns the options passed at the Job creation.

job = scheduler.schedule_in('10d', tag: 'hello') do; end
job.opts
  # => { :tag => 'hello' }

original

Returns the original schedule.

job = scheduler.schedule_in('10d', tag: 'hello') do; end
job.original
  # => '10d'

callable, handler

callable() returns the scheduled block (or the call method of the callable object passed in lieu of a block)

handler() returns nil if a block was scheduled and the instance scheduled otherwise.

# when passing a block

job =
  scheduler.schedule_in('10d') do
    # ...
  end

job.handler
  # => nil
job.callable
  # => #<Proc:0x00000001dc6f58@/home/jmettraux/whatever.rb:115>

and

# when passing something else than a block

class MyHandler
  attr_reader :counter
  def initialize
    @counter = 0
  end
  def call(job, time)
    @counter = @counter + 1
  end
end

job = scheduler.schedule_in('10d', MyHandler.new)

job.handler
  # => #<Method: MyHandler#call>
job.callable
  # => #<MyHandler:0x0000000163ae88 @counter=0>

source_location

Added to rufus-scheduler 3.8.0.

Returns the array [ 'path/to/file.rb', 123 ] like Proc#source_location does.

require 'rufus-scheduler'

scheduler = Rufus::Scheduler.new

job = scheduler.schedule_every('2h') { p Time.now }

p job.source_location
  # ==> [ '/home/jmettraux/rufus-scheduler/test.rb', 6 ]

scheduled_at

Returns the Time instance when the job got created.

job = scheduler.schedule_in('10d', tag: 'hello') do; end
job.scheduled_at
  # => 2013-07-17 23:48:54 +0900

last_time

Returns the last time the job triggered (is usually nil for AtJob and InJob).

job = scheduler.schedule_every('10s') do; end

job.scheduled_at
  # => 2013-07-17 23:48:54 +0900
job.last_time
  # => nil (since we've just scheduled it)

# after 10 seconds

job.scheduled_at
  # => 2013-07-17 23:48:54 +0900 (same as above)
job.last_time
  # => 2013-07-17 23:49:04 +0900

previous_time

Returns the previous #next_time

scheduler.every('10s') do |job|
  puts "job scheduled for #{job.previous_time} triggered at #{Time.now}"
  puts "next time will be around #{job.next_time}"
  puts "."
end

last_work_time, mean_work_time

The job keeps track of how long its work was in the last_work_time attribute. For a one time job (in, at) it's probably not very useful.

The attribute mean_work_time contains a computed mean work time. It's recomputed after every run (if it's a repeat job).

next_times(n)

Returns an array of EtOrbi::EoTime instances (Time instances with a designated time zone), listing the n next occurrences for this job.

Please note that for "interval" jobs, a mean work time is computed each time and it's used by this #next_times(n) method to approximate the next times beyond the immediate next time.

unschedule

Unschedule the job, preventing it from firing again and removing it from the schedule. This doesn't prevent a running thread for this job to run until its end.

threads

Returns the list of threads currently "hosting" runs of this Job instance.

kill

Interrupts all the work threads currently running for this job instance. They discard their work and are free for their next run (of whatever job).

Note: this doesn't unschedule the Job instance.

Note: if the job is pooled for another run, a free work thread will probably pick up that next run and the job will appear as running again. You'd have to unschedule and kill to make sure the job doesn't run again.

running?

Returns true if there is at least one running Thread hosting a run of this Job instance.

scheduled?

Returns true if the job is scheduled (is due to trigger). For repeat jobs it should return true until the job gets unscheduled. "at" and "in" jobs will respond with false as soon as they start running (execution triggered).

pause, resume, paused?, paused_at

These four methods are only available to CronJob, EveryJob and IntervalJob instances. One can pause or resume such jobs thanks to these methods.

job =
  scheduler.schedule_every('10s') do
    # ...
  end

job.pause
  # => 2013-07-20 01:22:22 +0900
job.paused?
  # => true
job.paused_at
  # => 2013-07-20 01:22:22 +0900

job.resume
  # => nil

tags

Returns the list of tags attached to this Job instance.

By default, returns an empty array.

job = scheduler.schedule_in('10d') do; end
job.tags
  # => []

job = scheduler.schedule_in('10d', tag: 'hello') do; end
job.tags
  # => [ 'hello' ]

[]=, [], key?, has_key?, keys, values, and entries

Threads have thread-local variables, similarly Rufus-scheduler jobs have job-local variables. Those are more like a dict with thread-safe access.

job =
  @scheduler.schedule_every '1s' do |job|
    job[:timestamp] = Time.now.to_f
    job[:counter] ||= 0
    job[:counter] += 1
  end

sleep 3.6

job[:counter]
  # => 3

job.key?(:timestamp) # => true
job.has_key?(:timestamp) # => true
job.keys # => [ :timestamp, :counter ]

Locals can be set at schedule time:

job0 =
  @scheduler.schedule_cron '*/15 12 * * *', locals: { a: 0 } do
    # ...
  end
job1 =
  @scheduler.schedule_cron '*/15 13 * * *', l: { a: 1 } do
    # ...
  end

One can fetch the Hash directly with Job#locals. Of course, direct manipulation is not thread-safe.

job.locals.entries do |k, v|
  p "#{k}: #{v}"
end

call

Job instances have a #call method. It simply calls the scheduled block or callable immediately.

job =
  @scheduler.schedule_every '10m' do |job|
    # ...
  end

job.call

Warning: the Scheduler#on_error handler is not involved. Error handling is the responsibility of the caller.

If the call has to be rescued by the error handler of the scheduler, call(true) might help:

require 'rufus-scheduler'

s = Rufus::Scheduler.new

def s.on_error(job, err)
  if job
    p [ 'error in scheduled job', job.class, job.original, err.message ]
  else
    p [ 'error while scheduling', err.message ]
  end
rescue
  p $!
end

job =
  s.schedule_in('1d') do
    fail 'again'
  end

job.call(true)
  #
  # true lets the error_handler deal with error in the job call

AtJob and InJob methods

time

Returns when the job will trigger (hopefully).

next_time

An alias for time.

EveryJob, IntervalJob and CronJob methods

next_time

Returns the next time the job will trigger (hopefully).

count

Returns how many times the job fired.

EveryJob methods

frequency

It returns the scheduling frequency. For a job scheduled "every 20s", it's 20.

It's used to determine if the job frequency is higher than the scheduler frequency (it raises an ArgumentError if that is the case).

IntervalJob methods

interval

Returns the interval scheduled between each execution of the job.

Every jobs use a time duration between each start of their execution, while interval jobs use a time duration between the end of an execution and the start of the next.

CronJob methods

brute_frequency

An expensive method to run, it's brute. It caches its results. By default it runs for 2017 (a non leap-year).

  require 'rufus-scheduler'

  Rufus::Scheduler.parse('* * * * *').brute_frequency
    #
    # => #<Fugit::Cron::Frequency:0x00007fdf4520c5e8
    #      @span=31536000.0, @delta_min=60, @delta_max=60,
    #      @occurrences=525600, @span_years=1.0, @yearly_occurrences=525600.0>
      #
      # Occurs 525600 times in a span of 1 year (2017) and 1 day.
      # There are least 60 seconds between "triggers" and at most 60 seconds.

  Rufus::Scheduler.parse('0 12 * * *').brute_frequency
    # => #<Fugit::Cron::Frequency:0x00007fdf451ec6d0
    #      @span=31536000.0, @delta_min=86400, @delta_max=86400,
    #      @occurrences=365, @span_years=1.0, @yearly_occurrences=365.0>
  Rufus::Scheduler.parse('0 12 * * *').brute_frequency.to_debug_s
    # => "dmin: 1D, dmax: 1D, ocs: 365, spn: 52W1D, spnys: 1, yocs: 365"
      #
      # 365 occurrences, at most 1 day between each, at least 1 day.

The CronJob#frequency method found in rufus-scheduler < 3.5 has been retired.

looking up jobs

Scheduler#job(job_id)

The scheduler #job(job_id) method can be used to look up Job instances.

  require 'rufus-scheduler'

  scheduler = Rufus::Scheduler.new

  job_id =
    scheduler.in '10d' do
      # ...
    end

  # later on...

  job = scheduler.job(job_id)

Scheduler #jobs #at_jobs #in_jobs #every_jobs #interval_jobs and #cron_jobs

Are methods for looking up lists of scheduled Job instances.

Here is an example:

  #
  # let's unschedule all the at jobs

  scheduler.at_jobs.each(&:unschedule)

Scheduler#jobs(tag: / tags: x)

When scheduling a job, one can specify one or more tags attached to the job. These can be used to look up the job later on.

  scheduler.in '10d', tag: 'main_process' do
    # ...
  end
  scheduler.in '10d', tags: [ 'main_process', 'side_dish' ] do
    # ...
  end

  # ...

  jobs = scheduler.jobs(tag: 'main_process')
    # find all the jobs with the 'main_process' tag

  jobs = scheduler.jobs(tags: [ 'main_process', 'side_dish' ]
    # find all the jobs with the 'main_process' AND 'side_dish' tags

Scheduler#running_jobs

Returns the list of Job instance that have currently running instances.

Whereas other "_jobs" method scan the scheduled job list, this method scans the thread list to find the job. It thus comprises jobs that are running but are not scheduled anymore (that happens for at and in jobs).

misc Scheduler methods

Scheduler#unschedule(job_or_job_id)

Unschedule a job given directly or by its id.

Scheduler#shutdown

Shuts down the scheduler, ceases any scheduler/triggering activity.

Scheduler#shutdown(:wait)

Shuts down the scheduler, waits (blocks) until all the jobs cease running.

Scheduler#shutdown(wait: n)

Shuts down the scheduler, waits (blocks) at most n seconds until all the jobs cease running. (Jobs are killed after n seconds have elapsed).

Scheduler#shutdown(:kill)

Kills all the job (threads) and then shuts the scheduler down. Radical.

Scheduler#down?

Returns true if the scheduler has been shut down.

Scheduler#started_at

Returns the Time instance at which the scheduler got started.

Scheduler #uptime / #uptime_s

Returns since the count of seconds for which the scheduler has been running.

#uptime_s returns this count in a String easier to grasp for humans, like "3d12m45s123".

Scheduler#join

Lets the current thread join the scheduling thread in rufus-scheduler. The thread comes back when the scheduler gets shut down.

#join is mostly used in standalone scheduling script (or tiny one file examples). Calling #join from a web application initializer will probably hijack the main thread and prevent the web application from being served. Do not put a #join in such a web application initializer file.

Scheduler#threads

Returns all the threads associated with the scheduler, including the scheduler thread itself.

Scheduler#work_threads(query=:all/:active/:vacant)

Lists the work threads associated with the scheduler. The query option defaults to :all.

  • :all : all the work threads
  • :active : all the work threads currently running a Job
  • :vacant : all the work threads currently not running a Job

Note that the main schedule thread will be returned if it is currently running a Job (ie one of those blocking: true jobs).

Scheduler#scheduled?(job_or_job_id)

Returns true if the arg is a currently scheduled job (see Job#scheduled?).

Scheduler#occurrences(time0, time1)

Returns a hash { job => [ t0, t1, ... ] } mapping jobs to their potential trigger time within the [ time0, time1 ] span.

Please note that, for interval jobs, the #mean_work_time is used, so the result is only a prediction.

Scheduler#timeline(time0, time1)

Like #occurrences but returns a list [ [ t0, job0 ], [ t1, job1 ], ... ] of time + job pairs.

dealing with job errors

The easy, job-granular way of dealing with errors is to rescue and deal with them immediately. The two next sections show examples. Skip them for explanations on how to deal with errors at the scheduler level.

block jobs

As said, jobs could take care of their errors themselves.

scheduler.every '10m' do
  begin
    # do something that might fail...
  rescue => e
    $stderr.puts '-' * 80
    $stderr.puts e.message
    $stderr.puts e.stacktrace
    $stderr.puts '-' * 80
  end
end

callable jobs

Jobs are not only shrunk to blocks, here is how the above would look like with a dedicated class.

scheduler.every '10m', Class.new do
  def call(job)
    # do something that might fail...
  rescue => e
    $stderr.puts '-' * 80
    $stderr.puts e.message
    $stderr.puts e.stacktrace
    $stderr.puts '-' * 80
  end
end

TODO: talk about callable#on_error (if implemented)

(see scheduling handler instances and scheduling handler classes for more about those "callable jobs")

Rufus::Scheduler#stderr=

By default, rufus-scheduler intercepts all errors (that inherit from StandardError) and dumps abundant details to $stderr.

If, for example, you'd like to divert that flow to another file (descriptor), you can reassign $stderr for the current Ruby process

$stderr = File.open('/var/log/myapplication.log', 'ab')

or, you can limit that reassignement to the scheduler itself

scheduler.stderr = File.open('/var/log/myapplication.log', 'ab')

Rufus::Scheduler#on_error(job, error)

We've just seen that, by default, rufus-scheduler dumps error information to $stderr. If one needs to completely change what happens in case of error, it's OK to overwrite #on_error

def scheduler.on_error(job, error)

  Logger.warn("intercepted error in #{job.id}: #{error.message}")
end

On Rails, the on_error method redefinition might look like:

def scheduler.on_error(job, error)

  Rails.logger.error(
    "err#{error.object_id} rufus-scheduler intercepted #{error.inspect}" +
    " in job #{job.inspect}")
  error.backtrace.each_with_index do |line, i|
    Rails.logger.error(
      "err#{error.object_id} #{i}: #{line}")
  end
end

Callbacks

Rufus::Scheduler #on_pre_trigger and #on_post_trigger callbacks

One can bind callbacks before and after jobs trigger:

s = Rufus::Scheduler.new

def s.on_pre_trigger(job, trigger_time)
  puts "triggering job #{job.id}..."
end

def s.on_post_trigger(job, trigger_time)
  puts "triggered job #{job.id}."
end

s.every '1s' do
  # ...
end

The trigger_time is the time at which the job triggers. It might be a bit before Time.now.

Warning: these two callbacks are executed in the scheduler thread, not in the work threads (the threads where the job execution really happens).

Rufus::Scheduler#around_trigger

One can create an around callback which will wrap a job:

def s.around_trigger(job)
  t = Time.now
  puts "Starting job #{job.id}..."
  yield
  puts "job #{job.id} finished in #{Time.now-t} seconds."
end

The around callback is executed in the thread.

Rufus::Scheduler#on_pre_trigger as a guard

Returning false in on_pre_trigger will prevent the job from triggering. Returning anything else (nil, -1, true, ...) will let the job trigger.

Note: your business logic should go in the scheduled block itself (or the scheduled instance). Don't put business logic in on_pre_trigger. Return false for admin reasons (backend down, etc), not for business reasons that are tied to the job itself.

def s.on_pre_trigger(job, trigger_time)

  return false if Backend.down?

  puts "triggering job #{job.id}..."
end

Rufus::Scheduler.new options

:frequency

By default, rufus-scheduler sleeps 0.300 second between every step. At each step it checks for jobs to trigger and so on.

The :frequency option lets you change that 0.300 second to something else.

scheduler = Rufus::Scheduler.new(frequency: 5)

It's OK to use a time string to specify the frequency.

scheduler = Rufus::Scheduler.new(frequency: '2h10m')
  # this scheduler will sleep 2 hours and 10 minutes between every "step"

Use with care.

lockfile: "mylockfile.txt"

This feature only works on OSes that support the flock (man 2 flock) call.

Starting the scheduler with lockfile: '.rufus-scheduler.lock' will make the scheduler attempt to create and lock the file .rufus-scheduler.lock in the current working directory. If that fails, the scheduler will not start.

The idea is to guarantee only one scheduler (in a group of schedulers sharing the same lockfile) is running.

This is useful in environments where the Ruby process holding the scheduler gets started multiple times.

If the lockfile mechanism here is not sufficient, you can plug your custom mechanism. It's explained in advanced lock schemes below.

:scheduler_lock

(since rufus-scheduler 3.0.9)

The scheduler lock is an object that responds to #lock and #unlock. The scheduler calls #lock when starting up. If the answer is false, the scheduler stops its initialization work and won't schedule anything.

Here is a sample of a scheduler lock that only lets the scheduler on host "coffee.example.com" start:

class HostLock
  def initialize(lock_name)
    @lock_name = lock_name
  end
  def lock
    @lock_name == `hostname -f`.strip
  end
  def unlock
    true
  end
end

scheduler =
  Rufus::Scheduler.new(scheduler_lock: HostLock.new('coffee.example.com'))

By default, the scheduler_lock is an instance of Rufus::Scheduler::NullLock, with a #lock that returns true.

:trigger_lock

(since rufus-scheduler 3.0.9)

The trigger lock in an object that responds to #lock. The scheduler calls that method on the job lock right before triggering any job. If the answer is false, the trigger doesn't happen, the job is not done (at least not in this scheduler).

Here is a (stupid) PingLock example, it'll only trigger if an "other host" is not responding to ping. Do not use that in production, you don't want to fork a ping process for each trigger attempt...

class PingLock
  def initialize(other_host)
    @other_host = other_host
  end
  def lock
    ! system("ping -c 1 #{@other_host}")
  end
end

scheduler =
  Rufus::Scheduler.new(trigger_lock: PingLock.new('main.example.com'))

By default, the trigger_lock is an instance of Rufus::Scheduler::NullLock, with a #lock that always returns true.

As explained in advanced lock schemes, another way to tune that behaviour is by overriding the scheduler's #confirm_lock method. (You could also do that with an #on_pre_trigger callback).

:max_work_threads

In rufus-scheduler 2.x, by default, each job triggering received its own, brand new, thread of execution. In rufus-scheduler 3.x, execution happens in a pooled work thread. The max work thread count (the pool size) defaults to 28.

One can set this maximum value when starting the scheduler.

scheduler = Rufus::Scheduler.new(max_work_threads: 77)

It's OK to increase the :max_work_threads of a running scheduler.

scheduler.max_work_threads += 10

Rufus::Scheduler.singleton

Do not want to store a reference to your rufus-scheduler instance? Then Rufus::Scheduler.singleton can help, it returns a singleton instance of the scheduler, initialized the first time this class method is called.

Rufus::Scheduler.singleton.every '10s' { puts "hello, world!" }

It's OK to pass initialization arguments (like :frequency or :max_work_threads) but they will only be taken into account the first time .singleton is called.

Rufus::Scheduler.singleton(max_work_threads: 77)
Rufus::Scheduler.singleton(max_work_threads: 277) # no effect

The .s is a shortcut for .singleton.

Rufus::Scheduler.s.every '10s' { puts "hello, world!" }

advanced lock schemes

As seen above, rufus-scheduler proposes the :lockfile system out of the box. If in a group of schedulers only one is supposed to run, the lockfile mechanism prevents schedulers that have not set/created the lockfile from running.

There are situations where this is not sufficient.

By overriding #lock and #unlock, one can customize how schedulers lock.

This example was provided by Eric Lindvall:

class ZookeptScheduler < Rufus::Scheduler

  def initialize(zookeeper, opts={})
    @zk = zookeeper
    super(opts)
  end

  def lock
    @zk_locker = @zk.exclusive_locker('scheduler')
    @zk_locker.lock # returns true if the lock was acquired, false else
  end

  def unlock
    @zk_locker.unlock
  end

  def confirm_lock
    return false if down?
    @zk_locker.assert!
  rescue ZK::Exceptions::LockAssertionFailedError => e
    # we've lost the lock, shutdown (and return false to at least prevent
    # this job from triggering
    shutdown
    false
  end
end

This uses a zookeeper to make sure only one scheduler in a group of distributed schedulers runs.

The methods #lock and #unlock are overridden and #confirm_lock is provided, to make sure that the lock is still valid.

The #confirm_lock method is called right before a job triggers (if it is provided). The more generic callback #on_pre_trigger is called right after #confirm_lock.

:scheduler_lock and :trigger_lock

(introduced in rufus-scheduler 3.0.9).

Another way of prodiving #lock, #unlock and #confirm_lock to a rufus-scheduler is by using the :scheduler_lock and :trigger_lock options.

See :trigger_lock and :scheduler_lock.

The scheduler lock may be used to prevent a scheduler from starting, while a trigger lock prevents individual jobs from triggering (the scheduler goes on scheduling).

One has to be careful with what goes in #confirm_lock or in a trigger lock, as it gets called before each trigger.

Warning: you may think you're heading towards "high availability" by using a trigger lock and having lots of schedulers at hand. It may be so if you limit yourself to scheduling the same set of jobs at scheduler startup. But if you add schedules at runtime, they stay local to their scheduler. There is no magic that propagates the jobs to all the schedulers in your pack.

parsing cronlines and time strings

(Please note that fugit does the heavy-lifting parsing work for rufus-scheduler).

Rufus::Scheduler provides a class method .parse to parse time durations and cron strings. It's what it's using when receiving schedules. One can use it directly (no need to instantiate a Scheduler).

require 'rufus-scheduler'

Rufus::Scheduler.parse('1w2d')
  # => 777600.0
Rufus::Scheduler.parse('1.0w1.0d')
  # => 777600.0

Rufus::Scheduler.parse('Sun Nov 18 16:01:00 2012').strftime('%c')
  # => 'Sun Nov 18 16:01:00 2012'

Rufus::Scheduler.parse('Sun Nov 18 16:01:00 2012 Europe/Berlin').strftime('%c %z')
  # => 'Sun Nov 18 15:01:00 2012 +0000'

Rufus::Scheduler.parse(0.1)
  # => 0.1

Rufus::Scheduler.parse('* * * * *')
  # => #<Fugit::Cron:0x00007fb7a3045508
  #      @original="* * * * *", @cron_s=nil,
  #      @seconds=[0], @minutes=nil, @hours=nil, @monthdays=nil, @months=nil,
  #      @weekdays=nil, @zone=nil, @timezone=nil>

It returns a number when the input is a duration and a Fugit::Cron instance when the input is a cron string.

It will raise an ArgumentError if it can't parse the input.

Beyond .parse, there are also .parse_cron and .parse_duration, for finer granularity.

There is an interesting helper method named .to_duration_hash:

require 'rufus-scheduler'

Rufus::Scheduler.to_duration_hash(60)
  # => { :m => 1 }
Rufus::Scheduler.to_duration_hash(62.127)
  # => { :m => 1, :s => 2, :ms => 127 }

Rufus::Scheduler.to_duration_hash(62.127, drop_seconds: true)
  # => { :m => 1 }

cronline notations specific to rufus-scheduler

first Monday, last Sunday et al

To schedule something at noon every first Monday of the month:

scheduler.cron('00 12 * * mon#1') do
  # ...
end

To schedule something at noon the last Sunday of every month:

scheduler.cron('00 12 * * sun#-1') do
  # ...
end
#
# OR
#
scheduler.cron('00 12 * * sun#L') do
  # ...
end

Such cronlines can be tested with scripts like:

require 'rufus-scheduler'

Time.now
  # => 2013-10-26 07:07:08 +0900
Rufus::Scheduler.parse('* * * * mon#1').next_time.to_s
  # => 2013-11-04 00:00:00 +0900

L (last day of month)

L can be used in the "day" slot:

In this example, the cronline is supposed to trigger every last day of the month at noon:

require 'rufus-scheduler'
Time.now
  # => 2013-10-26 07:22:09 +0900
Rufus::Scheduler.parse('00 12 L * *').next_time.to_s
  # => 2013-10-31 12:00:00 +0900

negative day (x days before the end of the month)

It's OK to pass negative values in the "day" slot:

scheduler.cron '0 0 -5 * *' do
  # do it at 00h00 5 days before the end of the month...
end

Negative ranges (-10--5-: 10 days before the end of the month to 5 days before the end of the month) are OK, but mixed positive / negative ranges will raise an ArgumentError.

Negative ranges with increments (-10---2/2) are accepted as well.

Descending day ranges are not accepted (10-8 or -8--10 for example).

a note about timezones

Cron schedules and at schedules support the specification of a timezone.

scheduler.cron '0 22 * * 1-5 America/Chicago' do
  # the job...
end

scheduler.at '2013-12-12 14:00 Pacific/Samoa' do
  puts "it's tea time!"
end

# or even

Rufus::Scheduler.parse("2013-12-12 14:00 Pacific/Saipan")
  # => #<Rufus::Scheduler::ZoTime:0x007fb424abf4e8 @seconds=1386820800.0, @zone=#<TZInfo::DataTimezone: Pacific/Saipan>, @time=nil>

I get "zotime.rb:41:in `initialize': cannot determine timezone from nil"

For when you see an error like:

rufus-scheduler/lib/rufus/scheduler/zotime.rb:41:
  in `initialize':
    cannot determine timezone from nil (etz:nil,tnz:"中国标准时间",tzid:nil)
      (ArgumentError)
    from rufus-scheduler/lib/rufus/scheduler/zotime.rb:198:in `new'
    from rufus-scheduler/lib/rufus/scheduler/zotime.rb:198:in `now'
    from rufus-scheduler/lib/rufus/scheduler.rb:561:in `start'
    ...

It may happen on Windows or on systems that poorly hint to Ruby which timezone to use. It should be solved by setting explicitly the ENV['TZ'] before the scheduler instantiation:

ENV['TZ'] = 'Asia/Shanghai'
scheduler = Rufus::Scheduler.new
scheduler.every '2s' do
  puts "#{Time.now} Hello #{ENV['TZ']}!"
end

On Rails you might want to try with:

ENV['TZ'] = Time.zone.name # Rails only
scheduler = Rufus::Scheduler.new
scheduler.every '2s' do
  puts "#{Time.now} Hello #{ENV['TZ']}!"
end

(Hat tip to Alexander in gh-230)

Rails sets its timezone under config/application.rb.

Rufus-Scheduler 3.3.3 detects the presence of Rails and uses its timezone setting (tested with Rails 4), so setting ENV['TZ'] should not be necessary.

The value can be determined thanks to https://en.wikipedia.org/wiki/List_of_tz_database_time_zones.

Use a "continent/city" identifier (for example "Asia/Shanghai"). Do not use an abbreviation (not "CST") and do not use a local time zone name (not "中国标准时间" nor "Eastern Standard Time" which, for instance, points to a time zone in America and to another one in Australia...).

If the error persists (and especially on Windows), try to add the tzinfo-data to your Gemfile, as in:

gem 'tzinfo-data'

or by manually requiring it before requiring rufus-scheduler (if you don't use Bundler):

require 'tzinfo/data'
require 'rufus-scheduler'

so Rails?

Yes, I know, all of the above is boring and you're only looking for a snippet to paste in your Ruby-on-Rails application to schedule...

Here is an example initializer:

#
# config/initializers/scheduler.rb

require 'rufus-scheduler'

# Let's use the rufus-scheduler singleton
#
s = Rufus::Scheduler.singleton


# Stupid recurrent task...
#
s.every '1m' do

  Rails.logger.info "hello, it's #{Time.now}"
  Rails.logger.flush
end

And now you tell me that this is good, but you want to schedule stuff from your controller.

Maybe:

class ScheController < ApplicationController

  # GET /sche/
  #
  def index

    job_id =
      Rufus::Scheduler.singleton.in '5s' do
        Rails.logger.info "time flies, it's now #{Time.now}"
      end

    render text: "scheduled job #{job_id}"
  end
end

The rufus-scheduler singleton is instantiated in the config/initializers/scheduler.rb file, it's then available throughout the webapp via Rufus::Scheduler.singleton.

Warning: this works well with single-process Ruby servers like Webrick and Thin. Using rufus-scheduler with Passenger or Unicorn requires a bit more knowledge and tuning, gently provided by a bit of googling and reading, see Faq above.

avoid scheduling when running the Ruby on Rails console

(Written in reply to gh-186)

If you don't want rufus-scheduler to trigger anything while running the Ruby on Rails console, running for tests/specs, or running from a Rake task, you can insert a conditional return statement before jobs are added to the scheduler instance:

#
# config/initializers/scheduler.rb

require 'rufus-scheduler'

return if defined?(Rails::Console) || Rails.env.test? || File.split($PROGRAM_NAME).last == 'rake'
  #
  # do not schedule when Rails is run from its console, for a test/spec, or
  # from a Rake task

# return if $PROGRAM_NAME.include?('spring')
  #
  # see https://github.com/jmettraux/rufus-scheduler/issues/186

s = Rufus::Scheduler.singleton

s.every '1m' do
  Rails.logger.info "hello, it's #{Time.now}"
  Rails.logger.flush
end

(Beware later version of Rails where Spring takes care pre-running the initializers. Running spring stop or disabling Spring might be necessary in some cases to see changes to initializers being taken into account.)

rails server -d

(Written in reply to https://github.com/jmettraux/rufus-scheduler/issues/165 )

There is the handy rails server -d that starts a development Rails as a daemon. The annoying thing is that the scheduler as seen above is started in the main process that then gets forked and daemonized. The rufus-scheduler thread (and any other thread) gets lost, no scheduling happens.

I avoid running -d in development mode and bother about daemonizing only for production deployment.

These are two well crafted articles on process daemonization, please read them:

If, anyway, you need something like rails server -d, why not try bundle exec unicorn -D instead? In my (limited) experience, it worked out of the box (well, had to add gem 'unicorn' to Gemfile first).

executor / reloader

You might benefit from wraping your scheduled code in the executor or reloader. Read more here: https://guides.rubyonrails.org/threading_and_code_execution.html

support

see getting help above.


Author: jmettraux
Source code: https://github.com/jmettraux/rufus-scheduler
License: MIT license

#ruby 

Rufus Scheduler: Job Scheduler for Ruby (at, Cron, in and Every Jobs)

HR BIZ HUB

1638251688

Top 20 Skills to have on your resume

There are endless skills that you can include on any resume, and you have to decide which ones will be the most effective.
.
Let us help with the top 20 skills that our Inspiration Pooja Sankhala analyzed and have seen be the most successful.

www.hrbizhub.com

Pooja Sankhala Pooja Sankhala monika sankhala Jagruti Hiwase Priya Jha Gaurav Yadav
#skills #resume #softskills #hardskills #hrbizhub #Top20

Top 20 Skills to have on your resume
Holden  Zemlak

Holden Zemlak

1637061240

Write a GREAT Software Tester RESUME: For Experienced & Freshers

In this video, we are going to learn about the How to write a resume for software testing profile. I have discussed about few points and reviewed 2 resumes for the mistakes.

🔥 Notes & Resume Download - https://sdet.live/notes

#resume #softwaretester  #selenium 

Write a GREAT Software Tester RESUME: For Experienced & Freshers