Skip to content

Instantly share code, notes, and snippets.

@Ank13
Ank13 / Toranut reminder script.js
Last active February 4, 2020 17:10
script to automatically remind people via email when they have toranut duty, based on entries on a Google Spreadsheet
function sendEmails() {
// Get the main data // getRange(row, column, numRows, numColumns)
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("DatesOfDuty")
var lastRow = sheet.getLastRow();
var data = sheet.getRange(2, 1,lastRow, 4).getValues();
// Other variables
var instructions = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("MessageToSend").getRange(1,1).getValues();
var daysBeforeToSend = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("MessageToSend").getRange(2,6).getValues();
var EMAIL_SENT = 'EMAIL_SENT';
@Ank13
Ank13 / state_finder.rb
Created February 18, 2014 20:10
Get the state name based on the abreviation
module AbeviationToState
def self.find_state(abreviation)
STATES_HASH[abreviation]
end
STATES_HASH = {
'AL' => 'Alabama',
'AK' => 'Alaska',
'AZ' => 'Arizona',
puts "Rock, Paper, Scissors, shoot!"
puts "(enter your choice)"
user_choice = gets.chomp.downcase
choices = ["rock", "paper", "scissors"]
computer_choice = choices[rand(3)]
puts "The computer chooses #{computer_choice}!"
puts "Tie!" if user_choice == computer_choice
puts "What year were your born?"
birth_year = gets.chomp
puts "What month were your born?"
birth_month = gets.chomp
puts "What day were your born?"
birth_day = gets.chomp
seconds_diff = Time.now - Time.new(birth_year, birth_month, birth_day)
@Ank13
Ank13 / dwolla_charge_test.rb
Last active December 28, 2015 08:19
Trying out the Dwolla API. Please see the second file below, 'issues.md', for a list of issues and questions for Dwolla regarding the API.
require 'rubygems'
require 'dwolla'
class User
attr_accessor :dwolla_oauth_token, :encrypted_dwolla_pin
def initialize(dwolla_oauth_token, pin)
@dwolla_oauth_token = dwolla_oauth_token
@pin = pin
end
@Ank13
Ank13 / socrates_link_scraper.rb
Last active December 19, 2015 20:48
This is a scraper to find the links on each challenge page in Socrates and export key details to a CSV file. To make this work, you need log in to Socrates on your browser, copy the appropriate Cookie from the headers (open the console and inspect headers to find your cookie), and paste into line 11 below.
@Ank13
Ank13 / index.html
Last active December 18, 2015 11:20 — forked from dbc-challenges/index.html
DBC Phase 2 Practice Assessment Part 3
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="http://cdn.jsdelivr.net/normalize/2.1.0/normalize.css">
<link rel="stylesheet" href="main.css">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Lato:100,900">
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/3.0.2/css/font-awesome.min.css">
</head>
@Ank13
Ank13 / zoo.js
Last active December 18, 2015 11:19 — forked from dbc-challenges/zoo.js
//------------------------------------------------------------------------------------------------------------------
// YOUR CODE: Create your Zoo "object literal" and Animal "constructor" and "prototypes" here.
//------------------------------------------------------------------------------------------------------------------
function Animal(name, legs){
this.name = name;
this.legs = legs;
};
Animal.prototype.identify = function(){
$(document).ready(function () {
$('body').on('click', '#roll_die', function(event) {
event.preventDefault();
var die_number = Math.floor(Math.random()*6 + 1)
var url = $('form').attr('action');
var new_image = '<img src="/' + die_number + '.png" ' + 'title="' + die_number + '" alt="the roll">'
$.post(url, function(data){
$('#die img').remove()
$('#die').append(new_image)