Inspired by YouTube video, Advanced Topics in Programming Languages: Concurrency/message passing Newsqueak.
public IEnumerable<int> Primes(int max)
{
int count = 0;
int candidatePrime = 2;
var primes = new List<int>(max);
Inspired by YouTube video, Advanced Topics in Programming Languages: Concurrency/message passing Newsqueak.
public IEnumerable<int> Primes(int max)
{
int count = 0;
int candidatePrime = 2;
var primes = new List<int>(max);
Features:
undefined
function binarySearch(arr, number) {
let start = 0
let end = arr.length - 1
See: https://sampleprograms.io/projects/baklava/javascript/
My attempt at backlava in JS.
Fetaures and difference to other implementation:
spaces
and stars
substr
to print the number of spaces and starsbacklava()
backlava()
returns a string rather than printing directly to the consoleUpon researching GraphQL, the question immediately came to my mind:
Why do we need another query language when we already have SQL?
A second question then came to mind:
Can we use SQL for API endpoints?
After asking this question, it now seems odd that REST style APIs would even be considered a good choice.
function medianSplit(array) { | |
let midPoint = array.length / 2 | |
array = array.sort((a, b) => a - b) | |
let firstHalf = array.slice(0, Math.floor(midPoint)) | |
let middle = array.slice(Math.floor(midPoint), Math.ceil(midPoint))[0] | |
let lastHalf = array.slice(Math.ceil(midPoint), array.length) | |
return [firstHalf, middle, lastHalf] | |
} | |
function median(array) { |
#!/usr/bin/env ruby | |
# Aside from removing Ruby on Rails specific code this is taken verbatim from | |
# mislav's git-deploy (http://github.com/mislav/git-deploy) and it's awesome | |
# - Ryan Florence (http://ryanflorence.com) | |
# | |
# Install this hook to a remote repository with a working tree, when you push | |
# to it, this hook will reset the head so the files are updated | |
if ENV['GIT_DIR'] == '.' |
One of the earliest Ruby constructs I learned about was Hash.new {|h, k| h[k] = {} }
.
This small one-liner is explored in many Ruby tutorials and it completely captured my imagination.
I've never been able to use this in a production app as I've always found a better solution.
However, one thing it might be good for is to take you on a short journey.
This journey will be interactive, so you will need to copy snippets of code into an irb or pry console. I recommend using ruby 2.6 or higher as the copy-paste functionality is better (and I havn't debugged on lower versions).
UPDATE: I've now added the caves_of_lemaria.rb
script which will run through the whole adventure!
I really dislike repeating my self in code I really dislike writing code just to get around language limitations
Typed languages are the absolute worst for code verbosity. The need to create object upon object to wrap and transform and present data is crazy
However, I do appreciate the type checking that goes along with Typed languages. I feel dynamic languages could actually acheive this by having the compiler create virtual interfaces for
###Sketch trial non stop
Open hosts files:
$ open /private/etc/hosts
Edit the file adding:
127.0.0.1 backend.bohemiancoding.com
127.0.0.1 bohemiancoding.sketch.analytics.s3-website-us-east-1.amazonaws.com
# frozen_string_literal: true | |
module SecureAttribute | |
extend ActiveSupport::Concern | |
# BCrypt hash function can handle maximum 72 bytes, and if we pass | |
# password of length more than 72 bytes it ignores extra characters. | |
# Hence need to put a restriction on password length. | |
MAX_PASSWORD_LENGTH_ALLOWED = 72 |