No Runtime Error:
func == (l: Car, r: Car) -> Bool { return l.vin == r.vin }
struct Car { let vin: String }
protocol hasDriversLicense: class {
var car: Car? { get set }
}
class YoungPro: hasDriversLicense {
// Procedure: | |
countWords(document.body); | |
/* | |
* Count the text inside each element. | |
* Parents include all the words of their children. |
@Injectable({providedIn: 'root'}) | |
export class ExternalUrlService implements CanActivate { | |
canActivate({ data }: ActivatedRouteSnapshot): boolean { | |
window.open(data.externalUrl, '_blank'); | |
return false; | |
} | |
} |
'atom-text-editor': | |
'cmd-backspace': 'editor:delete-line' | |
'cmd-up': 'editor:move-line-up' | |
'cmd-down': 'editor:move-line-down' | |
'cmd-d': 'editor:duplicate-lines' |
// Lights (white as a transparency) | |
$light10: rgba(255, 255, 255, 0.10); | |
$light20: rgba(255, 255, 255, 0.20); | |
$light30: rgba(255, 255, 255, 0.30); | |
$light40: rgba(255, 255, 255, 0.40); | |
$light50: rgba(255, 255, 255, 0.50); | |
$light60: rgba(255, 255, 255, 0.60); | |
$light70: rgba(255, 255, 255, 0.70); | |
$light80: rgba(255, 255, 255, 0.80); |
#!/bin/bash | |
# TODO: skip tiny files (so small they couldn't be photos) | |
# TODO: make sure sym links and other file system oddities are handled | |
# TODO: look at paralellization for perf boost | |
# | |
# Constants | |
# | |
CHAR_COUNT=12 | |
BLOCK_COUNT=6 |
import Foundation | |
/* | |
A starter animation library for swift. | |
These abstractions make it easier to chain multiple behaviors (eg: anticpate, then slam, then fade) | |
because you can use them as single liners and reason only about the actions. | |
Usage: |
// Pull a secret string out of ordered triplets | |
// https://www.codewars.com/kata/recover-a-secret-string-from-random-triplets/train/javascript | |
// https://www.codewars.com/kata/53f40dff5f9d31b813000774/solutions/javascript | |
// @LesRamer | |
var recoverSecret = function(triplets) { | |
for(var [first] of triplets) | |
{ | |
if (triplets.every(tuple => tuple.indexOf(first) <= 0)) | |
{ |
No Runtime Error:
func == (l: Car, r: Car) -> Bool { return l.vin == r.vin }
struct Car { let vin: String }
protocol hasDriversLicense: class {
var car: Car? { get set }
}
class YoungPro: hasDriversLicense {
// https://programmingpraxis.com/2011/08/30/hamming-numbers/ | |
// cosmin said | |
// October 30, 2012 at 7:14 PM | |
// Another solution based upon Dijkstra’s paper: | |
def hammingSeq(N): | |
h = [1] | |
i2, i3, i5 = 0, 0, 0 | |
for i in xrange(1, N): | |
x = min(2*h[i2], 3*h[i3], 5*h[i5]) |
# Update the system's packages | |
apt-get update | |
apt-get upgrade | |
# Set up the `deploy` user | |
useradd deploy | |
mkdir /home/deploy | |
mkdir /home/deploy/.ssh | |
chmod 700 /home/deploy/.ssh | |
usermod -s /bin/bash deploy |