Note: This was written using elasticsearch 0.9.
Elasticsearch will automatically create an index (with basic settings and mappings) for you if you post a first document:
$ curl -X POST 'http://localhost:9200/thegame/weapons/1' -d \
'{
"_id": 1,
<?php | |
/** | |
* Calculated the number of weekdays (M-F) between two timestamps (inclusive). | |
* | |
* @param string $from the timestamp to start measuring from | |
* @param string $to the timestamp to stop measuring at | |
* @param string $normalise whether the time of day should be ignored (forces times to yyyy-mm-ddT00:00:00+00:00) | |
* @return int the number of weekdays between the two timestamps | |
* @author Matt Harris | |
*/ |
A warning occurred (42 apples) | |
An error occurred |
Note: This was written using elasticsearch 0.9.
Elasticsearch will automatically create an index (with basic settings and mappings) for you if you post a first document:
$ curl -X POST 'http://localhost:9200/thegame/weapons/1' -d \
'{
"_id": 1,
Creating a service to startup at BeagleBone Black boot time:
Create a shell script such as /usr/bin/myFancyBash.sh:
#!/bin/bash
# this could be any runnable code or shell script, really
/usr/bin/myFancyPython.py
Note that the first line is critical.
// Copyright 2011 Google Inc. | |
// | |
// Licensed under the Apache License, Version 2.0 (the "License"); | |
// you may not use this file except in compliance with the License. | |
// You may obtain a copy of the License at | |
// | |
// http://www.apache.org/licenses/LICENSE-2.0 | |
// | |
// Unless required by applicable law or agreed to in writing, software | |
// distributed under the License is distributed on an "AS IS" BASIS, |
extension UIViewController { | |
func topMostViewController() -> UIViewController { | |
if self.presentedViewController == nil { | |
return self | |
} | |
if let navigation = self.presentedViewController as? UINavigationController { | |
return navigation.visibleViewController.topMostViewController() | |
} | |
if let tab = self.presentedViewController as? UITabBarController { | |
if let selectedTab = tab.selectedViewController { |
/* iPhone 6 landscape */ | |
@media only screen and (min-device-width: 375px) | |
and (max-device-width: 667px) | |
and (orientation: landscape) | |
and (-webkit-min-device-pixel-ratio: 2) | |
{ } | |
/* iPhone 6 portrait */ | |
@media only screen | |
and (min-device-width: 375px) |
Instructions for getting an ELK stack set up quick on Mac. Paths are opinionated. You'll have to infer and change. Sorry mate. 🍰
Install Homebrew if not already. You probably have. If not, you should.
brew install elasticsearch nginx
/** | |
Returns a UIColor object from a Hexadecimal string with a solid colour | |
i.e. | |
UIColorFromRGB("#FF0000") == UIColor.redColor() | |
UIColorFromRGB("#0000FF") == UIColor.blueColor() | |
UIColorFromRGB("#GGGGGG") == UIColor.blackColor() | |
UIColorFromRGB("#Hello") == UIColor.blackColor() |
<?php | |
// apitest.php | |
// by Karl Kranich - karl.kranich.org | |
// version 3.1 - edited query section | |
require_once realpath(dirname(__FILE__) . '/vendor/autoload.php'); | |
include_once "google-api-php-client/examples/templates/base.php"; | |
$client = new Google_Client(); |