Skip to content

Instantly share code, notes, and snippets.

View jedschneider's full-sized avatar

Jed Schneider jedschneider

View GitHub Profile
@jedschneider
jedschneider / gh-pages-tips.md
Created June 7, 2012 17:59
github pages tips for jekyll wiki

Working With Github Pages

The FAQ maintained by Github covers most stumbling blocks, some other tips and tricks supplied here.

Gitignore

Add _site to .gitignore. The generated site should not be uploaded to Github since its gets generated by github.

Working With Code Partials

module Main exposing (..)
import Html exposing (..)
import Html.App as Html
import Html.Attributes exposing (..)
import Html.Events exposing (onInput, onClick)
import String exposing (..)
import Char
import Maybe
import Html exposing (..)
import Html.App as Html
import Html.Attributes exposing (..)
import Html.Events exposing (onInput)
import String exposing (..)
import Char
main =
Html.beginnerProgram

cycling team planning tool

so it seems like there might space for a product that makes team communication easier. not like that is an underserved product category out there but still, i'm struggling to find a tool that makes it easy for users to

  • communicate a point to every one
  • keep it short and on topic
  • identify important dates and times
  • make it consumable by everyone.
# original solution in ruby tapas 150
class Median
def self.avdi(list)
sorted = list.sort
q, r = sorted.size.divmod(2)
middle = sorted[q - 1 + r, 2 - r]
middle.reduce(:+) / middle.size
end
@jedschneider
jedschneider / gist:6113442
Last active December 20, 2015 10:09
Another Take on 'I hated, hated, hated this CoffeeScript'

Another Take on 'I hated, hated, hated this CoffeeScript'

As a follow up to both the initial article and the followup, I wanted to give my own take on 'idiomatic CoffeeScript' as I see it. I'm a huge fan of Reggie's work and highly reccomend his books on CoffeeScript and JavaScript.

I like CoffeeScript's class syntax, I admit it. Not because I love OOP or think that we should necessarily think in in OOP concepts, but because it provides a clean functional interface for thinking in domain concepts. Classes in CoffeeScript are not classes, they are function wrappers with their own environments. If you want to think of them as classes, have at it, I won't blame you.

To review for Reggie's article, lets look at his concept of idiomatic CoffeeScript.

table = (numberO
class Page
require 'uri'
require 'json'
require 'net/http'
require 'net/https'
def initialize(name, markup, css)
@name = name
@markup = markup
@css = css
class Mustachio extends Backbone.View
render: (template_id, context) ->
@templates[template_id].call @, context
@prepare = ->
templates = {}
raw_templates = $('script[type="text/x-handlebars-template"]')
raw_templates.each (i, template) ->
$template = $(template)
// Generated by CoffeeScript 1.3.3
utensils.Bindable = (function() {
function Bindable(context, dataKey) {
if (context == null) {
context = $('body');
}
this.dataKey = dataKey != null ? dataKey : 'bindable';
this.bindables = $("[data-" + this.dataKey + "]", context);
window.utensils = {}