Skip to content

Instantly share code, notes, and snippets.

@cryocaustik
cryocaustik / numFormat.php
Created December 27, 2017 19:44
convert large numbers to abbreviations
<?php
function numFormat($number) {
if(!$number){
return $number;
}
$abbrevs = array(18 => "Q", 15 => "q", 12 => "t", 9 => "B", 6 => "M", 3 => "K", 0 => "");
foreach($abbrevs as $exponent => $abbrev) {
if($number >= pow(10, $exponent)) {
$display_num = $number / pow(10, $exponent);
@cryocaustik
cryocaustik / csv_to_json.js
Last active December 5, 2017 07:07
simple ajax to pull csv and return a predefined dictionary
function dataImport() {
var pathData = 'https://gist.githubusercontent.com/cryocaustik/cc33ed8db15683160bf64d4981f7c3f2/raw/1fa0c63dd79a4b3e976798ca48a098147d27917f/csv_test';
var jsonData;
$.ajax({
url: pathData,
async: false,
success: function(data) {
_data = data.split('\n').slice(1);
for (var row_indx in _data) {
col1,col2,col3,col4
row1val1,row1val2,row1val3,row1val4
row2val1,row2val2,row2val3,row2val4
row4val1,row4val2,row4val3,row3val4
@import url('https://fonts.googleapis.com/css?family=Artifika');
@import url('https://fonts.googleapis.com/css?family=Ubuntu:300');
.message-text{
font-size: 1.1em !important;
}
.markup{
font-family: 'Ubuntu', 'Segoe UI light' !important;
}