Skip to content

Instantly share code, notes, and snippets.

@motine
motine / cleanup_job.rb
Last active Apr 22, 2021
Simple Rails Monitoring
View cleanup_job.rb
# services/monitoring/cleanup_service.rb
class Monitoring::CleanupService
def self.run
Monitoring::Measurement.where("recorded_at < ?", 3.months.ago).delete_all
end
end
# let this service run nightly
@mikowl
mikowl / oneliners.js
Last active Mar 17, 2021
👑 Awesome one-liners you might find useful while coding.
View oneliners.js
// By @coderitual
// https://twitter.com/coderitual/status/1112297299307384833
// Remove any duplicates from an array of primitives.
const unique = [...new Set(arr)]
// Sleep in async functions. Use: await sleep(2000).
const sleep = (ms) => (new Promise(resolve => setTimeout(resolve, ms)));
// or
const sleep = util.promisify(setTimeout);
@david-crespo
david-crespo / README.md
Last active Jun 1, 2021
Download FB tagged photos and videos
View README.md

Download photos and videos you're tagged in on Facebook

Why

When you download an archive of your Facebook account, Facebook includes photos and videos you've uploaded, but not photos and videos you're tagged in that were uploaded by other people. This is a script to automatically download those.

Setup

This requires Python 3.

@JennDudley
JennDudley / rails_github_heroku.md
Created Apr 25, 2012
Steps to set up a new Rails app, initialize a git repo, push to Github and deploy to Heroku
View rails_github_heroku.md

This is a list of steps to:

  • Setup a new Rails app
  • Initialize a local repository using git
  • Create a new remote repository using GitHub
  • Change README.rdoc
  • Deploy to a cloud service - Heroku

Assumptions:

  • Ruby is installed (v 1.9.3)
  • Rails is installed (v 3.2.3)