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-Worktango, ex-Westpac, ex-ANZ, ex-Vend/Lightspeed, ex-Sailthru, ex-Pro7Sat1, ex-DailyMail, ex-Sanoma
  • Toronto, Canada
  • 10:29 (UTC -04:00)
  • X @zoltan_nz
View GitHub Profile
@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")
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 / 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;
/* Put your CSS here */
html, body {
margin: 20px;
}
.woof-message {
cursor: pointer;
}
.woof-message:hover button.close {
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle'
});
@zoltan-nz
zoltan-nz / application.controller.js
Last active September 1, 2015 11:22
experiment with models
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle'
});

Solar System animation - Pure CSS

Here is a true time scaled solar-system, which means that every objects have a time relative to an Earth year.

A Pen by Malik Dellidj on CodePen.

License.

@zoltan-nz
zoltan-nz / application.controller.js
Last active January 8, 2016 11:49
channel-picker-component-example
import Ember from 'ember';
export default Ember.Controller.extend({
values: {
0: 10,
1: 15,
2: 7,
3: 19,
4: 78,
import Ember from 'ember';
export default Ember.Helper.extend({
router: Ember.computed(function() {
return Ember.getOwner(this).lookup('router:main');
}),
compute([routeName, ...routeParams]) {
let router = this.get('router');