Attention: the list was moved to
https://github.com/dypsilon/frontend-dev-bookmarks
This page is not maintained anymore, please update your bookmarks.
# This script is to take daily backup of mongodb | |
#**** Created by Manish Shrivastava **** | |
#================================================= | |
# Instead of backing up on set days this will check the time differences | |
# between the last backup and the time the script running. | |
# Useful if you're backing up irregularly on a laptop | |
#!/usr/local/ruby/bin/ruby -w |
#This script is to take mysql backup script, take backup into compressed format and delete old backups | |
# Author: Manish Shrivastava | |
#!/bin/bash | |
# BEGIN CONFIGURATION ========================================================== | |
BACKUP_DIR="/home/whatever" # The directory in which you want backups placed | |
KEEP_MYSQL="14" # How many days worth of mysql dumps to keep | |
KEEP_SITES="2" # How many days worth of site tarballs to keep |
[{ | |
"Question": { | |
"QID": 1, | |
"Type": "multiple", | |
"ContentType": "multiple", | |
"Text": "What is best programming language?", | |
"OptionList": [{ | |
"Opt": { | |
"Value": 1, | |
"OTexts": "Ruby", |
Attention: the list was moved to
https://github.com/dypsilon/frontend-dev-bookmarks
This page is not maintained anymore, please update your bookmarks.
# A method to define the bubble sort | |
def bubble_sort(array) | |
# condition: When array has more than one element | |
if array.count > 1 | |
swap = true | |
# Loop: Run until swap is true | |
while swap | |
swap = false | |
# Loop: Run loop with array counts and swap if | |
(array.length-1).times do |z| |
I hereby claim:
To claim this, I am signing this object:
# model code will have filters scope | |
class EvStation < ApplicationRecord | |
has_many :connections | |
has_many :amenities | |
scope :filter_by_free, ->(is_free) { where(is_free: is_free) } | |
scope :filter_by_usage_type, ->(usage_type_id) { where(usage_type_id: usage_type_id) } | |
scope :filter_by_power, ->(power_kw) { where(id: Connection.select(:ev_station_id).where("power_kw > ?", power_kw)) } | |
scope :filter_by_amenities, ->(amenity_ids) { joins(:amenities).where(amenities: { id: amenity_ids.split(',').map(&:to_i) }).distinct } |