Skip to content

Instantly share code, notes, and snippets.

@tsamb
tsamb / 0.2.1-boggle_class_from_methods.rb
Last active January 1, 2016 09:08 — forked from dbc-challenges/0.2.1-boggle_class_from_methods.rb
phase 0 unit 2 week 1 boggle class challenge
class BoggleBoard
def initialize(board)
@board = board
end
def create_word(*coords)
coords.map { |coord| @board[coord.first][coord.last]}.join("")
end
@tsamb
tsamb / index.html
Last active August 29, 2015 13:56 — 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>
@tsamb
tsamb / zoo.js
Created February 6, 2014 17:13 — forked from dbc-challenges/zoo.js
//------------------------------------------------------------------------------------------------------------------
// YOUR CODE: Create your Zoo "object literal" and Animal "constructor" and "prototypes" here.
//------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------
// DRIVER CODE: Do **NOT** change anything below this point. Your task is to implement code above to make this work.
//------------------------------------------------------------------------------------------------------------------
@tsamb
tsamb / carousel.js
Created February 6, 2014 20:49 — forked from ksolo/carousel.js
Image Carousel

DBC Hackathon working doc

@tsamb
tsamb / drag.html
Created June 17, 2015 12:50
Simple drag and drop in JavaScript
<html>
<head>
<title>drag and drop demo</title>
</head>
<body>
<div id="box" style="background-color:green;width:100px;height:100px; position:absolute; cursor:pointer"></div>
<script type="text/javascript">
// get and name the element
var box = document.getElementById("box");
@tsamb
tsamb / glow.css
Created May 17, 2016 19:05
Css glow animation
.glowing-gold {
-webkit-animation: gold-glow 0.75s ease-in-out infinite alternate;
-moz-animation: gold-glow 0.75s ease-in-out infinite alternate;
animation: gold-glow 0.75s ease-in-out infinite alternate;
}
@-webkit-keyframes gold-glow {
from {
box-shadow: 0 0 10px #fff, 0 0 20px #fff, 0 0 30px #fff, 0 0 40px #FFDD1B, 0 0 70px #FFDD1B, 0 0 80px #FFDD1B, 0 0 100px #FFDD1B, 0 0 150px #FFDD1B;
}
@tsamb
tsamb / imageswapper.js
Created July 8, 2016 00:05
Some code to paste into the console of webpages to change all of their images. (The website must have jQuery installed!)
// How do you create an prompt on the page then get an input of a search term
// Then replace all of the images with images based on that search term?
jQuery.getJSON(
"https://api.giphy.com/v1/gifs/search",
{q: "Ryan Gosling", api_key: "dc6zaTOxFJmzC"}
).done(function(response) {
var images = response.data.map(function(imgObj) {
return imgObj.images.original.url;
});
@tsamb
tsamb / airtable-record-activity-to-csv.js
Last active March 11, 2020 15:33
A dev console pasteable script for creating a CSV from the Airtable record history/activity panel
// In Airtable, expand a record and make sure its activity panel is expanded.
// Click "Show more" at the top of the activity panel until you get to the beginning of the record's history.
// Press Ctrl+Shift+J (on PC) or Cmd+Opt+J (on Mac) in your Chrome browser to pull up the JavaScript console.
// Paste the below script into the console to download the activity history as a CSV.
function arrayToCSV(nestedArray, exportName) {
const filename = exportName || "exported_js.csv";
const csvString = nestedArray.map((row) => row.map((field) => '\"' + field + '\"').join(',')).join('\r\n');
let a = document.createElement('a');
function PRECIPITATION_YESTERDAY() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var rainfallSheet = ss.getSheetByName("Brooklyn daily rainfall");
var hourlyWeatherSheet = ss.getSheetByName("Brooklyn hourly weather");
// DEPENDENCY: Assumes worksheets exist with the above to names.
var endpoint = "https://api.openweathermap.org/data/2.5/onecall/timemachine";
var unixTimeYesterday = Math.floor((new Date((new Date).setDate(((new Date).getDate() - 1)))).valueOf() / 1000);