Skip to content

Instantly share code, notes, and snippets.

View wouterw's full-sized avatar
🎯
Focusing

Wouter Willaert wouterw

🎯
Focusing
  • Bruges, Belgium
  • 19:17 (UTC +02:00)
View GitHub Profile
@krisselden
krisselden / index.hbs
Created April 25, 2014 06:01
sortable-list component example
{{#each fruits}}
{{this}}
{{/each}}
{{draggable-list values=fruits}}
# This won't be live if bars is a hasMany relationship
foo.get 'bars'
# Instead do this and use the patch below to get a live array:
hasManyHack foo, 'bars'
# workaround for https://github.com/emberjs/data/issues/1308 -
# once the SSOT branch is merged this should be able to be replaced
@knomedia
knomedia / ember_cli_rails.rake
Last active August 29, 2015 14:00
ember_cli_rails initial thoughts (see: https://github.com/knomedia/ember-cli-rails for a more complete solution)
require 'nokogiri'
namespace :ember_cli_rails do
desc "compile ember and update application.html.erb with ENV vars"
task :build => [:ember, :update_env] do
end
desc 'Build ember app and copies css and js files to rails'
@lordhumunguz
lordhumunguz / Sample_Gruntfile.coffee
Last active August 29, 2015 14:02
A sample grunt file for {blog url}
module.exports = (grunt) ->
timestamp = Date.now().toString()
grunt.initConfig
env: grunt.file.readJSON '.env.json'
s3:
options:
key: '<%= env.AWS.AccessKeyId %>'
secret: '<%= env.AWS.SecretKey %>'
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
def index
render text: index_html
end
private
def index_html
@courajs
courajs / helpers-radio-button.js
Created June 3, 2014 17:01
Cooler magic binding radio buttons
import RadioView from '../views/radio';
export default Ember.Handlebars.makeViewHelper(RadioView);
var Toggler = require('./toggler');
var React = require('react/addons');
var assert = chai.assert;
var Simulate = React.addons.TestUtils.Simulate
describe('Toggler', function(){
var toggler, el;
beforeEach(function() {
@brianjlandau
brianjlandau / gist:aa33f69932a4089a4de9
Created June 17, 2014 18:07
More strict web URL regex for validations. (better then URI.regexp)
require 'uri'
hostname = "(?:(?:[\\w\\-]+\\.)+[[:alpha:]]{2,})"
host = "(?:#{hostname}|#{URI::DEFAULT_PARSER.pattern[:IPV4ADDR]}|#{URI::DEFAULT_PARSER.pattern[:IPV6ADDR]})"
server = "//(?:#{URI::DEFAULT_PARSER.pattern[:USERINFO]}@)?#{host}(?::\\d*)?"
absolute_path = "(?:#{URI::DEFAULT_PARSER.pattern[:ABS_PATH]})?"
query = URI::DEFAULT_PARSER.pattern[:QUERY]
http_uri_regex = Regexp.new("\\A(?:http|https):(?:#{server}#{absolute_path})(?:\\?(?:#{query}))?\\z", Regexp::EXTENDED, 'N')
@poteto
poteto / computed-properties.js
Last active August 29, 2015 14:09
Slack-like loading messages in an Ember app
var computed;
App.computed = {};
computed = Ember.computed;
App.computed.sample = function(dependentKey) {
return (computed("" + dependentKey + ".@each", function() {
var items, length;
items = this.getWithDefault(dependentKey, Em.A([]));