Skip to content

Instantly share code, notes, and snippets.

View hodak's full-sized avatar
🦾
https://ubots.co

Adam Hodowany hodak

🦾
https://ubots.co
View GitHub Profile
$scope.dateSt = moment();
$scope.optionsSt = {};
<mighty-datepicker ng-model="dateSt" options="optionsSt"></mighty-datepicker>
$scope.markers = [
{
day: moment(),
marker: "tutoti"
},
{
day: moment().add('day', 2),
marker: "tutotite"
}
]
_callthis = function(day) {
console.log("call this: ", day);
}
_filter = function (day) {
w = day.weekday();
return w < 6 && w > 0;
}
$scope.multi = [moment(), moment().add('day', 2), moment().add('day', 5)];
$scope.date = null;
$scope.options = {
months: 1,
after: moment(),
template: template
};
<mighty-datepicker ng-model="date" options="options"></mighty-datepicker>
<mighty-datepicker ng-model="date" options="options"></mighty-datepicker>
<body ng-app="TestApp">
<div ng-controller="TestCtrl">
<div>
<h1>Simple date picker</h1>
<mighty-datepicker ng-model="date" options="options"></mighty-datepicker>
</div>
<div>
<h1>Multiple date picker</h1>
<mighty-datepicker ng-model="multi" options="optionsM"></mighty-datepicker>
</div>
angular.module("TestApp", ["mightyDatepicker"]);
angular.module("TestApp").controller("TestCtrl", function($scope){
_callthis = function(day) {
console.log("call this: ", day);
}
_filter = function (day) {
w = day.weekday();
return w < 6 && w > 0;
}
@hodak
hodak / gist:64ba93f37ce2770580cb
Created May 5, 2015 13:25
Angular 1.4 paramSerializer

Angular < 1.4

# Angular
$http.get({
  url: '/api/search'
  method: 'GET'
  params:
    filters:
 a: true
@hodak
hodak / users_controller.rb
Created April 10, 2015 07:50
Structuring simple API responses
module API
class UsersController
# This will cause problems in exactly two years from now
def index
render json: User.all
end
# Writing it this way from the beginning will allow
# to extend this object when the requirements change
def index
@hodak
hodak / gist:c46eecad751449a15c5f
Created January 26, 2015 08:02
Issues with migrating to bundler's source blocks
@hodak
hodak / .vimrc
Created January 16, 2015 12:04
./bin/rspec || rspec
if filereadable("bin/rspec")
let g:vroom_spec_command = './bin/rspec --format=documentation'
else
let g:vroom_spec_command = 'rspec --format=documentation'
endif