Skip to content

Instantly share code, notes, and snippets.

View tb's full-sized avatar
🚀
Building High-Performing Software Engineering Teams

Tomasz Bak tb

🚀
Building High-Performing Software Engineering Teams
View GitHub Profile
@eimermusic
eimermusic / gist:3744939
Created September 18, 2012 18:38
Tiny simple sort-action for Ember.js ArrayController content
App.UsersController = Ember.ArrayController.extend({
sortProperties: ['name'],
sortAscending: true,
reSort: function(sortBtnValue) {
var sortProperty = this.get('sortProperties')[0];
if (sortProperty == sortBtnValue) {
if (this.get('sortAscending')) {
this.set('sortAscending', false);
} else {
@toranb
toranb / filtersortpagemixin.js
Created September 24, 2012 02:37
filter/sort/pagination mixin for ember.js
var get = Ember.get;
/**
* @extends Ember.Mixin
*
* Implements common filter / sort / pagination behavior for array controllers
* */
Ember.FilterSortSliceMixin = Ember.Mixin.create({
filterBy: '',
require 'singleton'
# outputs a colored call-trace graph to the Rails logger of the lines of ruby code
# invoked during a single request.
#
# Example:
#
# 1) Make sure this file is loaded in an initializer
#
# 2) Add the following to your application.rb in Rails3:
require 'RMagick'
require 'capybara'
require 'launchy'
module Capybara::Recording
def start_recording
system "rm -f tmp/*"
end
def save_recording
//our app
var HelloEmber = Ember.Application.create({});
//our model
HelloEmber.Greeting = Ember.Object.extend();
HelloEmber.Greeting.reopenClass({
get : function(){
return {greeting : "Good Morning Starshine!", happyThought : "The Earth Says Hello!"}
}
});
@knownasilya
knownasilya / rsvpAjax.js
Created July 11, 2013 13:42
RSVP with jQuery.ajax
return Ember.RSVP.Promise(function (resolve, reject) {
var hash = {
url: geocodeUrl + "/" + params.latlng,
dataType: "jsonp",
jsonp: "jsonp",
data: {
key: apiKey,
includeEntityTypes: "Address"
}
};
@mattclar
mattclar / simple_form.rb
Last active December 21, 2015 13:58 — forked from tommarshall/simple_form.rb
this is a simple form initializer that is ALMOST compatible with Bootstrap3 apart from a way to set the class of the label this would work perfectly
# http://stackoverflow.com/questions/14972253/simpleform-default-input-class
# https://github.com/plataformatec/simple_form/issues/316
inputs = %w[
CollectionSelectInput
DateTimeInput
FileInput
GroupedCollectionSelectInput
NumericInput
PasswordInput
@jbruni
jbruni / example-template.html
Last active December 23, 2015 11:39
AngularJS UI Bootstrap "extension" - Popover with bindable HTML template!
<p>Here comes the <b>bindable HTML</b> popover contents!!!</p>
<p>Number: {{number}}</p>
@mainyaa
mainyaa / angular-promise.coffee
Last active December 30, 2015 08:29
unit testing $q.all
'use strict'
# dependencies angularjs, karma, karma-mocha, mocha, chai
describe 'Unit: $q.all', () ->
it 'should simulate promise', inject ($q, $rootScope) ->
deferred1 = $q.defer()
promise1 = deferred1.promise
deferred2 = $q.defer()
@tbprojects
tbprojects / check_env_vars.rb
Created December 18, 2013 11:00
We are using figaro for storing services api_keys and we had a problem when one developer changed application.yml and forgot to inform other developers about it (but he did update application.example.yml). As a result of this the other developer experienced "bugs" in the application. Put this file to initializers to detect mismatch between appli…
require 'yaml'
example_vars = YAML.load_file('config/application.example.yml').keys
live_vars = Rails.env.production? ? (ENV.keys & example_vars) : YAML.load_file('config/application.yml').keys
unless live_vars.sort == example_vars.sort
raise 'There is a mismatch between application.yml and application.example.yml'
end