- Two Sum ===========
Given an array of integers, return indices of the two numbers such that they add up to a specific target.
You may assume that each input would have exactly one solution.
// Input:
var ints = [5, 4, 3, 7, 1]
function includesAll (string, ...values) { | |
return values.every(el => string.includes(el)) | |
} | |
function replaceAll (originalString, string2replace, replaceWith) { | |
return originalString.split(string2replace).join(replaceWith) | |
} |
import React, { Component } from 'react' | |
import { connect } from 'react-redux' | |
import { getData, signup } from './actions' | |
@connect(state => ({ | |
user: state.user // <- this is an example of how you grab the global state in your components | |
}), dispatch => ({ | |
signup: (username, password) => dispatch(signup(username, password)) // <- you can either do it LIKE THIS |
Given an array of integers, return indices of the two numbers such that they add up to a specific target.
You may assume that each input would have exactly one solution.
// Input:
var ints = [5, 4, 3, 7, 1]
<?php | |
# Display errors in production mode | |
ini_set('display_errors', '0'); | |
error_reporting(E_ALL & E_ERROR); | |
ini_set('display_errors', 1); | |
?> | |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> ... |
<div class="container"> | |
<div class="row"> | |
<div class="col-xs-6 col-sm-4 col-md-3"> | |
<div id="wrap" class="text-center"> | |
<div class="thumbnail2"> | |
<div class="thumbnail"> | |
<a href="#myModal"> | |
<div class="caption"> | |
<!-- <button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal"> --> | |
<!-- BEGIN MODAL HERE --> |
<a data-toggle="modal" href="#myModal" class="btn btn-primary">Launch modal</a> | |
<div class="modal" id="myModal"> | |
<div class="modal-dialog"> | |
<div class="modal-content"> | |
<div class="modal-header"> | |
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> | |
<h4 class="modal-title">Login</h4> | |
</div> | |
<div class="modal-body"> |
" Only open nerdtree if no file was specified on startup | |
function! StartUpNerdtree() | |
if 0 == argc() | |
NERDTree | |
end | |
endfunction | |
autocmd VimEnter * call StartUpNerdtree() |
display dialog "my variable: " & myVar |
<?php | |
/** | |
* dbug (mixed $expression [, mixed $expression [, $... ]]) | |
* Author : dcz | |
* Feel free to use as you wish at your own risk ;-) | |
*/ | |
function dbug() { | |
static $output = '', $doc_root; | |
$args = func_get_args(); | |
if (!empty($args) && $args[0] === 'print') { |
<?php | |
// Assuming today is March 10th, 2001, 5:16:18 pm, and that we are in the | |
// Mountain Standard Time (MST) Time Zone | |
$today = date("F j, Y, g:i a"); // March 10, 2001, 5:16 pm | |
$today = date("m.d.y"); // 03.10.01 | |
$today = date("j, n, Y"); // 10, 3, 2001 | |
$today = date("Ymd"); // 20010310 | |
$today = date('h-i-s, j-m-y, it is w Day'); // 05-16-18, 10-03-01, 1631 1618 6 Satpm01 | |
$today = date('\i\t \i\s \t\h\e jS \d\a\y.'); // it is the 10th day. |