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
-- a little flame in a functional style | |
function particle(step, style, t) | |
local newStyle = step(style, t) | |
return { | |
style = newStyle, | |
next = function() | |
return particle(step, newStyle, t + 1) | |
end | |
} |
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
http= require 'http' | |
ss= require 'socketstream' | |
express= require 'express' | |
metro= express() | |
connectRedis= require 'connect-redis' | |
redisStore= connectRedis express | |
metro.use express.json() |
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
body { | |
font-family: Helvetica, arial, sans-serif; | |
font-size: 14px; | |
line-height: 1.6; | |
padding-top: 10px; | |
padding-bottom: 10px; | |
background-color: white; | |
padding: 30px; } | |
body > *:first-child { |
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
c= console.log | |
c "another arabic to roman numeral translator: \n" | |
digitiser= (integra)-> | |
if integra >= 10000 then c "error, we're only taking numbers less than 10,000" | |
strang= integra.toString() | |
rayy= strang.split '' | |
arq= {} | |
switch strang.length | |
when 4 |
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
# some array exercises around the codility exercise | |
c= console.log | |
# functions: | |
# 0- check if order is non decreasing | |
# 1- check if array can be made non-decreasing with just one swap. (or less) | |
# 2- getAll repeated element substrings (one black sheep allowed). this may not be helpful for finding (1), but it's a good exercise in itself | |
# possible algos approaches for finding (1) | |
# - if array small then could just go through all combos blindly and check if order is good. slightly better to only go through those swaps which transfer large to back of array and small to front. |
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
# jan2 request bluebird stuff | |
c= console.log | |
_= require 'lodash' | |
Promise= require 'bluebird' | |
rp= require 'request-promise' | |
qStr= require 'querystring' | |
parse_quals= (quals)-> | |
return _.reduce quals, | |
(acc0, value, key)-> |
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
/** | |
* This | |
*/ | |
import java.util.*; | |
public class StringHandler2{ | |
//public ArrayList<String> arrayPurms = new ArrayList<String>(); | |
public static ArrayList<String> SetPermute(HashSet <String> resultSet){ | |
System.out.println("We're in SetPermute. With argument " + resultSet.toString()); | |
ArrayList <String> arrayPurms = new ArrayList <String> (); | |
if (resultSet.size() == 1) { |
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
c = -> | |
message = _.reduce arguments, (acc, item) -> | |
item = util.inspect item | |
cursor = JSON.stringify item | |
message += cursor + "\n" | |
return acc + message | |
, "" | |
fs.appendFile 'log.txt', message, (err) -> |
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
c = -> console.log.apply console, arguments | |
c 'shunting ' | |
random_expression_string_builder = (nn) -> | |
rayy_builder = (n) -> | |
operators = ['+', '-', '*', '/'] | |
operands_rayy = [] | |
operators_rayy = [] |
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
c = -> console.log.apply console, arguments | |
c 'cracking the coding interview questions chapter 1' | |
c "Implement an algoritm to determine if a string has all unique characters. What if you can not use additional data structures?\n \n" | |
allowed_chars= ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'] | |
get_random_in_range = (range) -> | |
# get random integer between 0 and (range - 1) |
OlderNewer