Coder Social home page Coder Social logo

sometimes's Introduction

Sometimes

Stop being so black and white. Mix things up a bit and execute code sometimes.

A (very) simple collection of lil' helpers polluting namespaces because...why the hell not?

Installation

Works with only ruby 1.9.2 and up for now because I'm lazy and like the Random class.

Add this line to your Gemfile:

gem 'sometimes'

And then execute:

$ bundle

Require when needed

require 'sometimes'

Usage

Say something every other time

sometimes do
  puts "Hey, you are awesome. You really are."  # executes warm fuzzies 50% of the time
end

Maybe you want to do something several times, but not always the exact same number of times

(4..10).times do
  pick_nose  # between 4 and 10 boogers made, it's unpredictable!
end

Maybe you want to remind someone of something, but not toooo often (It gets annoying!)

15.percent_of_the_time do
  puts "Howdy, Don't forget to register!"  # be annoying, but only 15% of the time
end

33.percent_of_the_time do
  be_very_polite
end

Share a rare moment with your user

rarely do
  puts "How would you like some spammy spam spam!"  # be really annoying about 5% of the time
end

1.percent_of_the_time do
  puts "Want to see something really cool?"
end

If you can't say something nice, don't say anything at all:

never do
  puts "You're a terrible person"
end

Always remember your manners:

always do
  puts "Thanks for sharing!"
end

Why?

This gem was made so alonetone could bit more fun when displaying notices and communicating to our users.

We are human, and have personality. Shouldn't our applications reflect this? Be predictable where it counts. But toss in some spice here and there โ€” it is always a good thing.

sometimes's People

Contributors

sudara avatar alxndr avatar arturdryomov avatar jacobaweiss avatar leereilly avatar zachaysan avatar

Watchers

 avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.