This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
import AdultValidations from '../validations/adult'; | |
import ChildValidations from '../validations/child'; | |
const { get } = Ember; | |
export default Ember.Controller.extend({ | |
AdultValidations, | |
ChildValidations, | |
actions: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { test } from 'ember-qunit'; | |
import Ember from 'ember'; | |
export function testForHasMany(name, many) { | |
test('should have many ' + many, function(assert) { | |
const Model = this.store().modelFor(name); | |
const relationship = Ember.get(Model, 'relationshipsByName').get(many); | |
assert.equal(relationship.key, many, 'has relationship with ' + many); | |
assert.equal(relationship.kind, 'hasMany', 'kind of relationship is hasMany'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Mirage/*, {faker} */ from 'ember-cli-mirage'; | |
import Ember from 'ember'; | |
const { isEmpty } = Ember; | |
export function getAllJSONAPI(config, path, type, {meta: meta, belongsTo: belongsTo} = {}) { | |
config.get(path, function(db/*, request*/) { | |
let included = []; | |
let relationships = null; | |
if (!belongsTo) { belongsTo = [];} //make sure its array |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# bagged Lasso and elastic-net regularized generalized linear models | |
library(foreach) | |
library(glmnet) | |
Tiqoo.bagging <- function(data.train, data.test, length_divisor=5, iterations=5000){ | |
predictions <- foreach(m=1:iterations,.combine=cbind) %do% { | |
training_positions <- sample(nrow(data.train), size=floor((nrow(data.train)/length_divisor))) | |
train_pos <- 1:nrow(data.train) %in% training_positions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from pyspark.context import SparkContext | |
from numpy import array, random as np_random | |
from sklearn import linear_model as lm | |
from sklearn.base import copy | |
N = 10000 # Number of data points | |
D = 10 # Numer of dimensions | |
ITERATIONS = 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#= require spec_helper | |
describe "Summon.PrivatePubEventsDispatcher", -> | |
describe "will trigger actions", -> | |
beforeEach -> | |
@controller = Ember.Object.create | |
queuer: {id: "1"} | |
trigger: -> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# After reloading the configuration file, we can send [command] to an application | |
# running within tmux simply by pressing [command] twice. | |
set -g prefix C-j | |
bind C-j send-prefix | |
unbind C-b | |
# Splitting panes | |
bind | split-window -h | |
bind - split-window -v | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'digest/sha1' | |
require 'httparty' | |
require 'uri' | |
serverUrl = "http://api.dianping.com/" | |
apiPath = "v1/business/find_businesses" | |
appkey = "xxxxxxxxx" | |
secret = "xxxxxxxxxxxxxxxxxxxxxxxxxx" | |
param = {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
apt-get -y update | |
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline5-dev libyaml-dev git-core | |
cd /tmp | |
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p125.tar.gz | |
tar -xvzf ruby-1.9.3-p125.tar.gz | |
cd ruby-1.9.3-p125/ | |
./configure --prefix=/usr/local | |
make | |
make install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module SocialAppConfig | |
['twitter', 'renren', 'facebook', 'douban', 'tsina', 'tqq', 't163', 'kaixin', 'tsohu'].each do |auth| | |
raw_config = File.read("#{Rails.root}/config/providers/#{auth}.yml") | |
const_set "#{auth.upcase!}", YAML.load(raw_config)[Rails.env].symbolize_keys | |
end | |
end | |
include SocialAppConfig | |
Rails.application.config.middleware.use OmniAuth::Builder do |