Skip to content

Instantly share code, notes, and snippets.

View zoltan-nz's full-sized avatar
😃
Zoltan is typing...

Zoltan zoltan-nz

😃
Zoltan is typing...
  • Victoria University of Wellington, ex-MakeShift, ex-Worktango, ex-Westpac, ex-ANZ, ex-Vend/Lightspeed, ex-Sailthru, ex-Pro7Sat1, ex-DailyMail, ex-Sanoma
  • Toronto, Canada
View GitHub Profile
@zoltan-nz
zoltan-nz / css
Created May 28, 2014 14:02
Spinner
.spinner {
margin: auto;
height: 20px;
width: 20px;
-webkit-animation: spin 1.5s linear infinite;
-moz-animation: spin 1.5s linear infinite;
position: absolute;
top: 0;
right: 0;
bottom: 0;
App.DateField = Ember.TextField.extend
didInsertElement: ->
self = this
this.$().datepicker({format: 'dd.mm.yyyy'}).on 'changeDate', ->
self.$().trigger('change')
{{view App.DateField valueBinding="mydate"}}
@zoltan-nz
zoltan-nz / rails_sql_case_example.rb
Last active October 28, 2022 03:54
UPDATE more record with one query using CASE sql statement in Ruby on Rails. In this example update sort_order integer based on the sort order of products.
#List of product ids in sorted order. Get from jqueryui sortable plugin.
#product_ids = [3,1,2,4,7,6,5]
#product_ids.each_with_index do |id, index|
# Product.where(id: id).update_all(sort_order: index+1)
#end
##CASE syntax example:
##Product.where(id: product_ids).update_all("sort_order = CASE id WHEN 539 THEN 1 WHEN 540 THEN 2 WHEN 542 THEN 3 END")