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
(function() { | |
var resizeTimer; | |
// Assuming we have jQuery present | |
$( window ).on( "resize", function() { | |
// Use resizeTimer to throttle the resize handler | |
clearTimeout( resizeTimer ); | |
resizeTimer = setTimeout(function() { |
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
export default (fileInfo, api) => { | |
const j = api.jscodeshift; | |
const methods = []; | |
const root = j(fileInfo.source); | |
const body = root.find(j.Program).get('body', 0).node; | |
const { comments } = body; | |
delete body.comments | |
root.get().node.comments = comments; | |
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 app = {}; | |
app.$colors = $('canvas.color-palette'); | |
app.colorctx = app.$colors[0].getContext('2d'); | |
// Build Color palette | |
app.buildColorPalette = function() { | |
var gradient = app.colorctx.createLinearGradient(0, 0, app.$colors.width(), 0); | |
// Create color gradient |
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
<!doctype html> | |
<html> | |
<head> | |
<title>Number Test</title> | |
<style> | |
tr { | |
background: #ddd; | |
} | |
tr:nth-child(odd) { |
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
element.addEventListener('transitionend', function(e) { | |
let prop = e.propertyName.match(/border-(.*)-color/); | |
if (prop[1]) { | |
console.log(`Border color for ${prop[1]} transitioned`); | |
} | |
}); | |
element.addEventListener('transitionend', function(e) { | |
if (e.propertyName === 'border-top-left-radius') { |
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
def clear_cache domain | |
domain_parts = domain.match(/(?:[^:]*:\/\/)?([^\/]+\.[^\/]+)/) | |
domain = domain_parts[1] | |
Net::HTTP.get(domain, "/") | |
end |
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
@mixin rem( $property, $a:0, $b:$a, $c:$a, $d:$b ) { | |
@if ( $property == "font-size" ) { | |
// $a is the font size | |
// %b is the keyword | |
@if ( $a != $b ) { | |
font-size: $b; | |
} | |
@else { | |
font-size: $a * $base-font-multiplier * 16px; | |
} |
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
msgs = YAML::load(File.open("#{::Rails.root.to_s}/config/locales/devise.en.yml")) | |
msgs['en']['devise']['failure']['unauthenticated'] |
NewerOlder