Skip to content

Instantly share code, notes, and snippets.

View darthdeus's full-sized avatar

Jakub Arnold darthdeus

View GitHub Profile
@tomdale
tomdale / gist:3981133
Last active November 26, 2019 21:19
Ember.js Router API v2

WARNING

This gist is outdated! For the most up-to-date information, please see http://emberjs.com/guides/routing/!

It All Starts With Templates

An Ember application starts with its main template. Put your header, footer, and any other decorative content in application.handlebars.

<header>
@tomdale
tomdale / gist:4004913
Created November 2, 2012 23:10
Per-Type Adapters Proposal

Per-Type Adapter Hooks

Requirements

Many existing JSON APIs are not consistent between types. As JSON endpoints grew organically and were built by different engineers at different times, the style in which records are represented can vary wildly.

Historically, we have asked adapter authors to rely on the fact that the type of record is provided to all adapter hooks (either by passing a type argument, or by passing a record

@kurko
kurko / active_model_validations.js
Created January 4, 2013 03:18
A "gem" that converts the defined ActiveModel::Validations (validates in Rails' models) to JSON. Also, I created a JS code that invalidate fields based on this generated JSON.
// activeModelValidations
//
// This code is responsible for doing live validations in a form based on a
// JSON object serialized from the Rails' ActiveModel::Validations. This
// prototype interprets this JSON to do the validations.
//
// The entry point is:
//
// activeModelValidations.observe(JSON)
//
State = (hash) -> Em.State.extend hash
TransitionTo = Em.State.transitionTo
C = null
Receivers.WithdrawController = Em.ObjectController.extend
receiverController: null
router: null
init: ->
@_super()
UI.DatePicker = Ember.View.extend UI.Widget,
uiType: 'datepicker'
uiOptions: ['disabled', 'contrainInput', 'dateFormat', 'defaultDate', 'maxDate', 'minDate', ]
uiEvents: ['create', 'beforeShow', 'beforeShowDay', 'onChangeMonthYear'
'onClose', 'onSelect']
attributeBindings: ['type', 'value', 'placeholder']
type: 'text'
tagName: 'input'
@BlakeWilliams
BlakeWilliams / pickadate.coffee
Last active December 12, 2015 00:29
Remove useless parts.
App.PickADate = Ember.View.extend
attributes: ['monthsFull', 'monthsShort', 'weekdaysFull', 'weekdaysShort',
'monthPrev', 'monthNext', 'showMonthsFull', 'showWeekdaysShort', 'today',
'clear', 'format', 'formatSubmit', 'hiddenSuffix', 'firstDay', 'monthSelector',
'yearSelector', 'dateMin', 'dateMax', 'datesDisabled', 'disablePicker']
events: ['onOpen', 'onClose', 'onSelect', 'onStart']
attributeBindings: ['type', 'value', 'placeholder']
type: 'text'
tagName: 'input'
@walter
walter / example-modal.coffee
Last active December 12, 2015 01:58
Example modal code
# copied and modified from a working app, but there maybe typos in adaptation
# untested in this form
# router
App.Router.map (match) ->
@resource 'posts', ->
@route 'new'
@resource 'post', path: '/:post_id'
@mikegrassotti
mikegrassotti / README.md
Last active December 13, 2015 23:28
Experimenting with using jsbin for qunit tests. Hoping this can be better alternative to typical sample code for stack overflow answers. Instead of posting random code, post passing/failing test cases.

Ember + Qunit

This gist shows how we can run one of ember's qunit tests from jsbin. Should be possible to fork this and use as starting point for testing example code or components.

To open this gist in jsbin, visit: http://jsbin.com/gist/4991413

@benhoskings
benhoskings / ruby-2-cert-issue-fix.sh
Last active March 21, 2016 18:30
Ruby 2.0 CA cert issue fix
# If you're having cert issues on ruby 2.0.0-p0, the issue is most likely that ruby can't
# find the required intermediate certificates. If you built it via rbenv/ruby-build, then
# the certs are already on your system, just not where ruby expects them to be.
# When ruby-build installs openssl, it installs the CA certs here:
~/.rbenv/versions/2.0.0-p0/openssl/ssl/cacert.pem
# Ruby is expecting them here:
$(ruby -ropenssl -e 'puts OpenSSL::X509::DEFAULT_CERT_FILE')
# Which for me, is this path:
@maccman
maccman / pubsub.go
Last active December 15, 2016 22:30
// Go PubSub Server
//
// Usage - Subscribing:
// var conn = new EventSource('/subscribe');
// conn.addEventListener('message', function(e){ alert(e.data); }, false);
//
// Usage - Publishing:
// curl http://localhost:8080/publish -F 'msg=Hello World'
package main