$ docker
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
public class MyActivity extends AppcompatActivity implements View.OnClickListener{ | |
@Override | |
protected void onCreate(Bundle savedInstanceState){ | |
... | |
} | |
@Override | |
public void onClick(View view){ | |
switch(view.getId()){ |
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
var HashTable = function() { | |
this._storage = []; | |
this._count = 0; | |
this._limit = 8; | |
} | |
HashTable.prototype.insert = function(key, value) { | |
//create an index for our storage location by passing it through our hashing function | |
var index = this.hashFunc(key, this._limit); |
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
var gVariable = "foo"; | |
gVariable == window.gVariable; //returns true |
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
var addEventSystem = function(target){ | |
// Stores all the events. Keys -> event names, Values -> array of | |
// all callbacks for the events | |
target.reactionsTo = {}; | |
target.on = function(event, callback){ | |
// the event will act as the keys to the system | |
this.reactionsTo[event] = this.reactionsTo[event] || [] | |
this.reactionsTo[event].push(callback); | |
} | |
// Trigger all the callbacks based on the event being passed |
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
# put this in your .bash_profile | |
if [ $ITERM_SESSION_ID ]; then | |
export PROMPT_COMMAND='echo -ne "\033];${PWD##*/}\007"; ':"$PROMPT_COMMAND"; | |
fi | |
# Piece-by-Piece Explanation: | |
# the if condition makes sure we only screw with $PROMPT_COMMAND if we're in an iTerm environment | |
# iTerm happens to give each session a unique $ITERM_SESSION_ID we can use, $ITERM_PROFILE is an option too | |
# the $PROMPT_COMMAND environment variable is executed every time a command is run | |
# see: ss64.com/bash/syntax-prompt.html |
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
// Webpack configuration for react to work with all browsers | |
const path = require("path"); // node's path module | |
const htmlWebpackPlugin = require("html-webpack-plugin"); // creates your html with all jsx bundled to es5 | |
module.exports = { | |
entry: "./index.js", | |
output: { // path to the bundle | |
path: path.join(__dirname, "/bundle"), | |
filename: "bundle.js", |
This is a fork of original gist https://gist.github.com/nrollr/3f57fc15ded7dddddcc4e82fe137b58e, with slight changes on pointing to 5.7 version branch, instead of 8 (latest default of MySQL in Hombrew).
This procedure explains how to install MySQL using Homebrew on macOS (Sierra 10.12 and up)
- Installing Homebrew is effortless, open Terminal and enter :
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- Note: Homebrew will download and install Command Line Tools for Xcode 8.0 as part of the installation process.
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
Define a tray as a collection with length of 30 | |
Define the eggs | |
Iterate over the tray | |
Check if there's any empty space | |
If spaces exist | |
Fill up the empty tray spaces with an egg | |
If full | |
Inform farmer that tray is full | |
Create another tray |
OlderNewer