Skip to content

Instantly share code, notes, and snippets.

@jkintscher
jkintscher / saddle.php
Created February 13, 2012 15:58
Find existing saddle points in any given 2-dimensional matrix
<?php
function find_saddle_points($arr) {
$points = array();
// traverse the passed matrix by row
foreach($arr as $i => $row) {
// get the highest value from each row
$max = max($row);
@jkintscher
jkintscher / sparkline.svg
Last active December 10, 2015 11:59
Simple SVG Sparklines by Stuart Langridge (http://kryogenix.org/days/2012/12/30/simple-svg-sparklines)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jkintscher
jkintscher / ember-ror-setup.md
Last active December 10, 2015 20:38
Set up Ember.js on top of Ruby on Rails

rails new app_name -m http://emberjs.com/template.rb

Add config.ember.variant = :development to config/application.rb

rails g ember:install --head

Copy handlebars.js to vendor/assets/javascripts/

Update revision in app/assets/javascripts/store.js to latest (11)

token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g
timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[\-+]\d{4})?)\b/g
timezoneClip = /[^\-+\dA-Z]/g
i18n =
dayNames: [
'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat',
'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'
]
monthNames: [
class this.jsTimezone
timezone: null
@local: () ->
tz = new jsTimezone()
tz.determine()
###
Gets the offset in minutes from UTC for a certain date.
@jkintscher
jkintscher / add-vhost.sh
Last active February 2, 2021 12:04
Apache Virtual Host Setup on OSX
#!/bin/bash
vhost=$1
NO_COLOR=$'\033[0;39m'
YELLOW=$'\033[1;33m'
while [ -z "$vhost" ]; do
read -p "Name of new vHost in $YELLOW$PWD$NO_COLOR: " vhost
done
require 'json'
json = File.read('package.json')
dependencies = JSON.parse(json)
cmd = ''
dependencies['devDependencies'].each do |dependency|
version = dependency[1].gsub(/[\~]/, '')
cmd += 'npm install ' + dependency[0] + '@' + version + "\n"

EmberFest

  • Ember Data
  • Ember.RSVP.all
  • DS.Model.eachRelationship(.kind)

Recap

  • First EmberFest and first-ever Ember conference in Europe, took place in Munich
  • Around 80 attendees from 12 countries and 3 different continents (!)
@jkintscher
jkintscher / index.html
Created December 3, 2013 04:02
Ember-Model FixtureAdapter
<!DOCTYPE html>
<html>
<head>
<title>Fixture Adapter</title>
<script src="http://code.jquery.com/jquery-2.0.3.js"></script>
<script src="http://builds.handlebarsjs.com.s3.amazonaws.com/handlebars-v1.1.2.js"></script>
<script src="http://builds.emberjs.com/tags/v1.2.0/ember.js"></script>
<script src="http://builds.erikbryn.com/ember-model/ember-model-c45f01c08f2a951c2c2dee07122ea5420bf4e17a.js"></script>
</head>
@jkintscher
jkintscher / amadeus-reporting-ui-component-spec.md
Last active August 29, 2015 14:11
Reporting UI Component Spec

Questions

  • Can the same dimension (type) be used as a row and column dimension at the same time?

Key Concepts

  • A dimension is always passed around as its JSON representation.