Skip to content

Instantly share code, notes, and snippets.

04eb4f2551a2c95d3c99fdaa7417daee7d1e2f5490fdc30b640a36d4572f98c233caf861cfe02a03c0ecaaff9d4a4c071fc4457f1a5d58402ea1aabd9ca97a6ac2
@tomca32
tomca32 / mlquery.sql
Created June 28, 2017 02:49
Month-assessment query
select to_char(date_trunc('month', l.date), 'YYYY-MM') as month, count(distinct(l.id, g.student_id)) as assessments
from lessons as l
inner join grades as g
on l.id = g.lesson_id
group by month
order by month;
@tomca32
tomca32 / skill_regression_params.rb
Last active March 31, 2017 04:30
Naive Regression Params Mapping
# I'm just showing the naive way to do the mapping between skills and ther respective regression params.
# I'm ignoring getting the actual values from the DB, rendering HTML, and all other stuff that goes into this
skill_regression_params = {
memorization: {t1: 0.059758, t2: -0.00076, t3: some_number, t4: some_other_number},
grit: {t1: 0.039758, t2: -0.00236, t3: some_number, t4: some_other_number}
# ... etc for all skills
}
def skill_regression
@tomca32
tomca32 / schema.rb
Last active September 19, 2016 04:44
create_table "assignments", force: :cascade do |t|
t.integer "skill_id", null: false
t.integer "subject_id", null: false
t.index ["skill_id"], name: "index_assignments_on_skill_id"
t.index ["subject_id"], name: "index_assignments_on_subject_id"
end
create_table "grade_descriptors", force: :cascade do |t|
t.integer "mark", null: false
t.string "grade_description"

Keybase proof

I hereby claim:

  • I am tomca32 on github.
  • I am tomca32 (https://keybase.io/tomca32) on keybase.
  • I have a public key whose fingerprint is 0604 A56E 548E BD9C 871C B2C0 3D63 A4AB FA3D 528F

To claim this, I am signing this object:

@tomca32
tomca32 / lodash_guild.js
Created September 21, 2015 15:38
Lodash examples for FE Guild
_ = require("lodash");
var result;
var DATA = [
{name: "Student One",
id: 1,
scores: [30, 50, 80]
},
{name: "Student Two",
id: 2,
# Reading Machine Minds 2
#
# We say that a finite state machine is "empty" if it accepts no strings.
# Similarly, we say that a context-free grammar is "empty" if it accepts no
# strings. In this problem, you will write a Python procedure to determine
# if a context-free grammar is empty.
#
# A context-free grammar is "empty" starting from a non-terminal symbol S
# if there is no _finite_ sequence of rewrites starting from S that
# yield a sequence of terminals.
;
//Project Euler Problem #230 - Fibonacci Words
(function (exports) {
// var BigNumber = require('bignumber.js');
var SQ5 = Math.sqrt(5);
var RECSQ5 = 1/SQ5;
var C1 = (1+SQ5)/2;
@tomca32
tomca32 / Fibo words
Created August 1, 2013 17:30
Fibonacci Words
;
//Project Euler Problem #230 - Fibonacci Words
(function (exports) {
function getNumber (n) {
return (127+19*n)*(Math.pow(7,n));
}
exports.nFibo = function (n) {
@tomca32
tomca32 / coin sums problem
Created July 30, 2013 17:44
Coin sums problem recursively in JS
;
//Project Euler Problem #4 - Largest Palindrome Product
(function (exports) {
"use strict";
var coins = [1,2,5,10,20,50,100,200];
exports.change = function (money,i) {
if (money === 1 || money ===0) return 1;
if (i <0) return 0;