This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"editor.tokenColorCustomizations": { | |
"textMateRules": [ | |
{ | |
"name": "Comment", | |
"scope": [ | |
"comment", | |
"punctuation.definition.comment" | |
], | |
"settings": { | |
"fontStyle": "italic", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.image-container { | |
position: relative; | |
overflow: hidden; | |
} | |
.placeholder { | |
position: relative; | |
width: 100%; | |
filter: blur(10px); | |
transform: scale(1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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'); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
engine = Swiftype::Engine.find('engine-slug') | |
type = engine.document_type('books') | |
type.create_document({ | |
:external_id => id | |
:fields}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') |
NewerOlder