Skip to content

Instantly share code, notes, and snippets.

import Excel from 'exceljs'
import saveAs from 'file-saver'
const readFileAsync = (file) => {
return new Promise((resolve, reject) => {
let reader = new FileReader()
reader.onload = () => {
resolve(reader.result)
}
reader.onerror = reject
const valSchema = Yup.lazy(values => {
let validation = {
// put your non dynamic validation here
}
if (values.somethig) validation = {
...validation,
somethingBaseVal: Yup.object().shape({
// put dynamic validation
})
[SOME_ACITON]: (state, {index, name}) => {
return state
.mergeIn(['orders', action.index], { name: name })
.mergeIn(['orders', action.index, 'buttonState'], { status: 'SomeStatus' })
}
$('#header .navigation > nav > .ubermenu-nav > li.ubermenu-item-has-children').click(
function() {
if ($('body').hasClass('fading-page')) {
$('body').removeClass('fading-page');
} else {
$('body').addClass('fading-page');
}
}
);
$('#header .navigation > nav > .ubermenu-nav > li.ubermenu-item-has-children a').click(function(e) {
class CORS
self = this
constructor: ->
createCORSRequest = (method, url) ->
xhr = new XMLHttpRequest()
if(xhr.withCredentials != 'undefined')
xhr.open method, url, true
else if typeof(XDomainRequest) != 'undefined'
xhr = new XDomainRequest()
Puma caught this error: undefined method `bytesize' for #<Hash:0x007fe678d81768>
/Users/mirek/.rvm/gems/ruby-2.0.0-p0/gems/rack-1.5.2/lib/rack/utils.rb:335:in `bytesize'
/Users/mirek/.rvm/gems/ruby-2.0.0-p0/gems/sinatra-1.4.2/lib/sinatra/base.rb:144:in `block in finish'
/Users/mirek/.rvm/gems/ruby-2.0.0-p0/gems/sinatra-1.4.2/lib/sinatra/base.rb:144:in `each'
/Users/mirek/.rvm/gems/ruby-2.0.0-p0/gems/sinatra-1.4.2/lib/sinatra/base.rb:144:in `inject'
/Users/mirek/.rvm/gems/ruby-2.0.0-p0/gems/sinatra-1.4.2/lib/sinatra/base.rb:144:in `finish'
/Users/mirek/.rvm/gems/ruby-2.0.0-p0/gems/sinatra-1.4.2/lib/sinatra/base.rb:889:in `call!'
/Users/mirek/.rvm/gems/ruby-2.0.0-p0/gems/sinatra-1.4.2/lib/sinatra/base.rb:864:in `call'
/Users/mirek/.rvm/gems/ruby-2.0.0-p0/gems/rack-protection-1.5.0/lib/rack/protection/xss_header.rb:18:in `call'
/Users/mirek/.rvm/gems/ruby-2.0.0-p0/gems/rack-protection-1.5.0/lib/rack/protection/path_traversal.rb:16:in `call'