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
<?php | |
function make_assoc(&$input_array, $pkey = 'id') | |
{ | |
$keys = array_column($input_array, $pkey); | |
$input_array = array_combine($keys, $input_array); | |
ksort($input_array); | |
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
<?php | |
$data = 'a:9:{i:0;a:2:{s:7:"step_id";s:1:"1";s:9:"step_name";s:8:"Strategy";}i:1;a:2:{s:7:"step_id";s:1:"2";s:9:"step_name";s:9:"Structure";}i:2;a:2:{s:7:"step_id";s:1:"3";s:9:"step_name";s:7:"Finance";}i:3;a:2:{s:7:"step_id";s:1:"4";s:9:"step_name";s:14:"Buyer Advocacy";}i:4;a:2:{s:7:"step_id";s:1:"5";s:9:"step_name";s:24:"Renovation & Development";}i:5;a:2:{s:7:"step_id";s:1:"6";s:9:"step_name";s:19:"Property Management";}i:6;a:2:{s:7:"step_id";s:1:"7";s:9:"step_name";s:16:"Portfolio Review";}i:7;a:2:{s:7:"step_id";s:1:"8";s:9:"step_name";s:14:"Sales Advisory";}i:8;a:2:{s:7:"step_id";s:1:"9";s:9:"step_name";s:9:"Valuation";}}'; | |
function make_assoc(&$input_array, $pkey = 'id', $sort = FALSE) | |
{ | |
$keys = array_column($input_array, $pkey); | |
$input_array = array_combine($keys, $input_array); |
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
<?php | |
$this->output->set_header('Content-Encoding: gzip') | |
->set_header('Vary: Accept-Encoding') | |
->set_content_type('application/json') | |
->set_output(gzencode(json_encode($data), 9)); |
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
(function () { | |
var ID = "tooltip", CLS_ON = "tooltip_ON", FOLLOW = true, | |
DATA = "_tooltip", OFFSET_X = 20, OFFSET_Y = 10, | |
showAt = function (e) { | |
var ntop = e.pageY + OFFSET_Y, nleft = e.pageX + OFFSET_X; | |
$("#" + ID).html($(e.target).data(DATA)).css({ | |
position: "absolute", top: ntop, left: nleft | |
}).show(); | |
}; | |
$(document).on("mouseenter", "*[title]", function (e) { |
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
/** | |
* $.unserialize | |
* | |
* Takes a string in format "param1=value1¶m2=value2" and returns an object { param1: 'value1', param2: 'value2' }. If the "param1" ends with "[]" the param is treated as an array. | |
* | |
* Example: | |
* | |
* Input: param1=value1¶m2=value2 | |
* Return: { param1 : value1, param2: value2 } | |
* |
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
<?php | |
/** | |
* replace select in query | |
* | |
* @param string $query query to replace | |
* @param string $pkey primary key | |
* | |
* @return mixed|string | |
*/ | |
function count_row($query, $pkey) { |
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
#!/bin/bash | |
# Caddy daemon | |
# chkconfig: 345 20 80 | |
# description: Caddy daemon | |
# processname: caddy | |
DAEMON_PATH="/usr/local/bin" | |
DAEMON='./caddy' | |
DAEMONOPTS="-conf=/etc/caddy/Caddyfile -log /var/log/caddy.log" |
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
<?php | |
function make_assoc_dropdown(&$input_array, $pkey = 'id', $column = 'name') | |
{ | |
$keys = array_column($input_array, $pkey); | |
$input_array = array_combine($keys, array_column($input_array, $column)); | |
} |
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
package main | |
import ( | |
"fmt" | |
"net/http" | |
"io/ioutil" | |
"log" | |
"crypto/tls" | |
) |
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
<?php | |
function send_simple_message() { | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); | |
curl_setopt($ch, CURLOPT_USERPWD, 'api:key-example'); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST'); | |
curl_setopt($ch, CURLOPT_URL, | |
'https://api.mailgun.net/v2/samples.mailgun.org/messages'); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, |