Skip to content

Instantly share code, notes, and snippets.

View jasperkennis's full-sized avatar
💨
CODING

Jasper Kennis jasperkennis

💨
CODING
View GitHub Profile
@jasperkennis
jasperkennis / testplan.md
Last active August 28, 2015 09:02
A testplan for Fontanel Jobs and the integration with FreeAgent
getFormattedDate = ->
date = new Date()
date.getMonth() + "/" + date.getDate() + "/" + date.getFullYear() + " " + date.getHours() + ":" + date.getMinutes()
resetPullHeader = ->
actInd.hide()
imageArrow.transform = Ti.UI.create2DMatrix()
if refreshCount < 2
imageArrow.show()
labelStatus.text = "Pull down to refresh..."
labelLastUpdated.text = "Last Updated: " + getFormattedDate()
@jasperkennis
jasperkennis / dictkeys
Created September 3, 2014 08:04
Python object types as dict key demo
return {
Country: self.fetch_country(city),
Region: self.fetch_region(city),
City: self.fetch_city(city),
None: None
}[type(location)]
@jasperkennis
jasperkennis / readme.md
Last active August 29, 2015 14:20
Homerun CSS Rules

Purpose of this document:

Our CSS is a mess and needs to improve. Let's have some rules for that.

Style classes not elements

Our habit to style elements makes it easy to swap elements without affecting style.

Generalise styles

# config/initializers/active_admin.rb
ActiveAdmin.setup do |config|
# All the ActiveAdmin config stuf
end
Dir[ File.join(Rails.root, "lib", "active_admin_extentions", "*.rb") ].each {|l| require l }
@jasperkennis
jasperkennis / set-cookie.js.coffee
Created October 24, 2012 14:57
Simple function to quickly set a cookie. The function is attached to window so you can call it anywhere once it's loaded.
# By Oto Brglez - @otobrglez
# Rake task. Put in your (lib/tasks) folder of your Rails application
# Execute with "rake dropbox:backup"
# Configuration must be inside config/dropbox.yml file
namespace :dropbox do
desc "Backup production database to dropbox"
task :backup do
@jasperkennis
jasperkennis / calc.php
Created February 19, 2017 12:16
Finding the max value of y
#!/usr/bin/env php
<?php
$points = [
[6.13, 73],
[5.76, 77.7],
[5.39, 78.6]
];
$x1 = $points[0][0];
$x2 = $points[1][0];
@jasperkennis
jasperkennis / custom-hierarchical-menu.js
Created September 3, 2018 14:49
Retain open inbetween layers in Algolia Hierarchical menu
/**
* Custom implementation of hierarchical menu that keeps inbetween layers of the
* menu open.
*
* Implementation depends on jQuery being present.
*/
var $,
instantsearch,
instance_header,
@jasperkennis
jasperkennis / single-range-slider.js
Last active March 25, 2019 20:26
Single range slider for Slgolia
/**
* Custom implementation of range slider, with a single slider instead of two.
* Defaults min to 0, and allows the max to be changed using the slider.
*
* Implementation depends on jQuery and rangeslider (http://rangeslider.js.org/)
* to be present.
*/
var $,
custom_range_slider,