Skip to content

Instantly share code, notes, and snippets.

@florida
florida / README.md
Last active December 26, 2019 07:52
Fish Rainbow
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"name": "Comment",
"scope": [
"comment",
"punctuation.definition.comment"
],
"settings": {
"fontStyle": "italic",
window.onload = function() {
var largePicture = document.querySelector('.image-container')
// Load large image
var imgLarge = new Image();
imgLarge.src = largePicture.dataset.large;
imgLarge.onload = function () {
imgLarge.classList.add('loaded');
};
imgLarge.classList.add('picture');
.image-container {
position: relative;
overflow: hidden;
}
.placeholder {
position: relative;
width: 100%;
filter: blur(10px);
transform: scale(1);
<div class="image-container" data-large="https://assets.imgix.net/unsplash/bear.jpg?w=1000">
<img class="placeholder" src="https://assets.imgix.net/unsplash/bear.jpg?w=50" class="img-small">
</div>
<?php
// This will get today's date
$today = getdate();
print "Today is $today[month] $today[mday], $today[year]";
// Creating a new DateTime object
$new_date = new DateTime('02/31/2011');
?>
@florida
florida / creating_document.rb
Created March 20, 2013 18:34
Creating documents in swiftype
engine = Swiftype::Engine.find('engine-slug')
type = engine.document_type('books')
type.create_document({
:external_id => id
:fields})
@florida
florida / display_error.rb
Created October 6, 2012 19:16
Getting an error from saving an entry
# Validations may cause errors
# since if an object is required to have certain values
# and saved without them it will not be saved to the database.
# Here I am creating a method that will accept an object and attempt to save it
# it will also display the relevant errors
def check_for_errors(obj)
if (obj.save)
puts "save was successful"
# Reading with active record
# inspecting an object
# this will output the value
puts Object.first.inspect
# counts the number of objects in the database
puts Object.count
puts Object.size
@florida
florida / index.js
Created December 15, 2014 22:33
requirebin sketch
var raf = require('raf');
var Isomer = require('isomer');
var ease = require('ease-component');
var Color = require('color');
var duration = 5000
// create a canvas element and add it to the page
var canvas = document.createElement('canvas')