Skip to content

Instantly share code, notes, and snippets.

@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,
@tomca32
tomca32 / currying
Created July 14, 2013 23:18
Currying function
curryIt : function(fn) {
var args = [];
return function (a) {
args.push(a);
return args.length === fn.length ? fn.apply(null, args) : arguments.callee;
};
}
;
;
//Project Euler Problem #107 - Minimal Network
(function (exports) {
Array.prototype.map = function (f) {
if (this.length === 0) {
return [];
} else {
;
//Project Euler Problem #98 - Anagramic Squares
(function (exports) {
exports.parseWords = function() {
var fs = require ('fs');
var arr = fs.readFileSync('euler_files/words.txt').toString().split(',').map(function(s){
return s.replace(/"/g, "");
});//.split(",");
;
//Project Euler Problem #98 - Anagramic Squares
(function (exports) {
exports.parseWords = function() {
var fs = require ('fs');
var arr = fs.readFileSync('euler_files/words.txt').toString().split(',').map(function(s){
return s.replace(/"/g, "");
});//.split(",");
@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;
@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) {
;
//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;
# 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.

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: