Skip to content

Instantly share code, notes, and snippets.

View ChrisBuchholz's full-sized avatar

Christoffer Buchholz ChrisBuchholz

View GitHub Profile
var init = function () {
var data1, data2, data3, data4, data5, data6, data7, data8, data9, data10;
console.log('Start by waiting for a second...');
window.setTimeout(function() {
console.log('Then send a GET request to a couple of websites');
$.get('https://cors-test.appspot.com/test', function (data) {
data1 = data;
var init = sync(function* (resume) {
var data1, data2;
console.log('Start by waiting for a second...');
yield sleep(1000, resume);
console.log('Then send a GET request to a couple of websites with XMLHttpRequest');
data1 = yield get('https://cors-test.appspot.com/test', resume);
<?php
function get_cars() {
$ne = $_REQUEST['northeast'];
$sw = $_REQUEST['southwest'];
$args = array(
'post_type' => 'car',
'post_status' => 'publish',
'meta_query' => array(
<?php
$query = new WP_Query([
'meta_query' => [
'relation' => 'AND',
[
'key' => 'locationlat',
'value' => [$sw[0], $ne[0]],
'type' => 'numeric',
'compare' => 'BETWEEN'
var getCars = function () {
$.getJSON(url, function(cars) {
var $list = $('#min-liste-med-biler');
for (var i = 0; i < cars.length; i += 1) {
addCarToViewElm(cars[i], $list);
}
});
};
var addCarToViewElm = function (car, $elm) {
<?php
function ajax_get_cars() {
$ne = $_REQUEST['northeast'];
$sw = $_REQUEST['southwest'];
print_r(json_encode(get_cars($ne, $sq));
die;
}
@ChrisBuchholz
ChrisBuchholz / gist:7137530
Created October 24, 2013 13:40
Geo location inside bounds
$bounds = []; // bounds fra google maps
$query = new WP_Query([]); // din wp_query argumenter der henter alle posts ud
$markers_inside_bounds = [];
while ($query->have_posts()) {
$query->the_post();
$lat = get_field('lat');
SELECT wp_2_posts.* FROM wp_2_posts WHERE 1=1 AND wp_2_posts.post_type = 'lease' AND (wp_2_posts.post_status = 'publish' OR wp_2_posts.post_status = 'private') ORDER BY wp_2_posts.post_date DESC
<?php
add_filter('posts_where', 'unique_areas', 10, 2);
function unique_areas($where, $query) {
global $wpdb;
$where .= " AND DISTINCT {$wpdb->postmeta}.meta_value";
return $where;
}
sass
sass/ "echo ' compiling...' && sass --update -t compressed sass/%s.scss:css/%s.css"
gomake
. "go build && [ $? -eq 0 ] && echo 'No errors' && rm %s"