Write a Fork Bomb in Browser JavaScript that keeps opening browser windows.
/** | |
copy & paste into the browser console | |
on https://boards.greenhouse.io/andela | |
*/ | |
(() => { | |
// create display box | |
if (!$('#count-popover').length) { | |
$('#footer').append(`<div style="position:fixed;height:200px;width:200px;left:calc(50% - 100px);top: calc(50% - 100px);border:2px solid black;background-color: white;font-size: 50px;text-align: center;line-height: 200px;" id="count-popover">0</div>`) | |
} |
#!/bin/bash | |
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" | |
INTEROP_FOLDER="/Applications/Slack.app/Contents/Resources/app.asar.unpacked/src/static" | |
BACKUP_FILE="$DIR/backup/ssb-interop.js" | |
if [ -f "$BACKUP_FILE" ] | |
then | |
cp "$BACKUP_FILE" "$INTEROP_FOLDER" |
document.addEventListener('DOMContentLoaded', function() { | |
$.ajax({ | |
url: 'https://cdn.rawgit.com/laCour/slack-night-mode/master/css/raw/black.css', | |
success: function(css) { | |
let overrides = ` | |
code { background-color: #535353; color: #85c5ff; } /* Change color: to whatever font color you want */ | |
.c-mrkdwn__pre, .c-mrkdwn__quote { background: #535353 !important; background-color: #535353 !important; } | |
` | |
$("<style></style>").appendTo('head').html(css + overrides); | |
} |
{ | |
"Vue Template": { | |
"prefix": "VueTemplate", | |
"body": [ | |
"<template>", | |
"\t$0", | |
"</template>", | |
"", | |
"<script>", | |
"\texport default {", |
The car manufacturer Honda holds their distribution system in the form of a tree (not necessarily binary). The root is the company itself, and every node in the tree represents a car distributor that receives cars from the parent node and ships them to its children nodes. The leaf nodes are car dealerships that sell cars direct to consumers. In addition, every node holds an integer that is the cost of shipping a car to it.
Take for example the tree below:
See SampleTree.json
A path from Honda's factory to a car dealership, which is a path from the root to a leaf in the tree, is called a Sales Path. The cost of a Sales Path is the sum of the costs for every node in the path. For example, in the tree above one Sales Path is 0→3→0→10, and its cost is 13 (0+3+0+10).
Traditional relational databases have structure, so we use migrations to manage that structure in Laravel.
This is cool, until you find yourself creating tables for things that you don't need tables for, because none of the tables' columns act as foreign keys to keys on other tables.
E.g. a user_settings table would have a structure like
id | user_id | key | value |
---|
Array.prototype.paginate = function (length) { | |
var arr = this; | |
length = (length || 1); | |
return arr.reduce(function (a, b) { | |
if (!a[a.length - 1] || a[a.length - 1].length == length) a.push([]); | |
a[a.length - 1].push(b); | |
return a; | |
}, []); | |
} |
<?php | |
use Illuminate\Database\Migrations\Migration; | |
use Illuminate\Database\Schema\Blueprint; | |
use Illuminate\Support\Facades\Schema; | |
use App\Models\SampleMigration; | |
class SampleMigration extends Migration | |
{ | |
/** | |
* Run the migrations. |