- set min to 0 and max to array length
- compute guess as the result of (min + max)/2 rounded down
- if guess is greater than target value then I set max to guess - 1
- if guess is lesser than target value then I set min to guess + 1
- if guess is equal to target value I return guess
- if max < min or min > max then the target value is not contained in array
- if guess is not equal to target value I return to step 2.
This file contains hidden or 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
# pre-commit: run casperjs tests | |
echo "**********************************" | |
echo "pre commit ..." | |
echo "**********************************" | |
if [ -x "$(command -v casperjs)" ]; then | |
echo "**********************************" | |
echo "executing test" | |
echo "**********************************" |
This file contains hidden or 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
/** | |
* Animal constructor | |
**/ | |
var Animal = function(name) { | |
this.name = name; | |
}; | |
Animal.prototype.speak = function() { | |
console.log('my name is ' + this.name); | |
}; |
This file contains hidden or 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 evh = require('express-vhost'), | |
express = require('express'), | |
server = express(), | |
PORT = 80; | |
server.use(evh.vhost()); | |
server.listen(PORT); | |
evh.register('test.alexandreoger.eu', require('./test/index.js').app); | |
// evh.register(domain, server); |
This file contains hidden or 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
drush vset cache 0 | |
drush vset preprocess_css 0 | |
drush vset preprocess_js 0 |
This file contains hidden or 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
#baseline.show-grid { | |
background: -webkit-linear-gradient(top,rgba(50,50,50, 0.2)0,rgba(50,50,50, 0.2)1px,rgba(255, 255, 255, 0)1px,rgba(255, 255, 255, 0)2px); | |
background: -webkit-gradient(linear,left top,left bottom,color-stop(0px,rgba(50,50,50,.2)),color-stop(1px,rgba(50,50,50,.2)),color-stop(1px,rgba(255,255,255,0)),color-stop(2px,rgba(255,255,255,0))); | |
background: linear-gradient(to bottom,rgba(50,50,50, 0.2)0,rgba(50,50,50, 0.2)1px,rgba(255, 255, 255, 0)1px,rgba(255, 255, 255, 0)2px); | |
background-size: 100% 1rem; | |
} |
This file contains hidden or 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
// | |
// .important touch/click event | |
// ========================================================================== | |
/** | |
* Event factory | |
*/ | |
var eventFactory = function($elt, callback) { | |
var flag = true; | |
var touchStartPos; |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
</head> | |
<body> | |
<div class="container"> | |
<h1> | |
Lorem ipsum | |
</h1> | |
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Neque, suscipit velit nihil deleniti cumque reiciendis ea expedita commodi aut nemo assumenda asperiores harum dolorum ipsum at quidem ad iste fugiat. consectetur adipisicing elit. Neque, suscipit velit nihil deleniti cumque reiciendis ea expedita commodi aut nemo assumenda asperiores harum dolorum ipsum at quidem ad iste fugiat. </p> |
This file contains hidden or 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 myModule = (function($, window) { | |
// private property | |
var myProp = "hello"; | |
// private methods | |
function myPrivateMethod() { | |
alert($('*').length); | |
}; | |
// public methods | |
return { | |
init: function() { |