Skip to content

Instantly share code, notes, and snippets.

@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;
}
col1,col2,col3,col4
row1val1,row1val2,row1val3,row1val4
row2val1,row2val2,row2val3,row2val4
row4val1,row4val2,row4val3,row3val4
@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) {
@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 / asyncAjaxRequest.js
Last active February 23, 2018 18:49
example of async ajax request
function asyncRequest() {
var url = 'https://api.github.com/users/narenaryan';
return new Promise(function (resolve, reject) {
$.ajax({
url: url,
type: "GET"
})
.done(function(data){
resolve(data);
})
@cryocaustik
cryocaustik / README.md
Last active May 29, 2021 15:12
finds all CSV files in specified directory and loads them into specified sqlite database, using a row limit for reading large files
@cryocaustik
cryocaustik / copypasta.py
Created May 17, 2018 06:16
copy return delimited string from clipboard and then paste and submit each entry
def copypaste():
_list = pc.paste().split('\n')
for indx, _item in enumerate(_list):
if indx == 0:
_cd = list(range(5))
_cd.reverse()
for _c in _cd:
print('copy pasta in {}...'.format(_c))
sleep(1)
pc.copy(_item)
@cryocaustik
cryocaustik / dateAdd.js
Created June 19, 2018 23:23
JS Date Addition/Subtraction function
function dateAdd(interval, qty, _date) {
if(!_date){_date = new Date();}
if (interval.toLowerCase() === 'd') {
if(qty >= 0){
_date.setDate(_date.getDate() + qty);
} else {
_date.setDate(_date.getDate() - Math.abs(qty));
}
return _date;
data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAGuAAAAtACAIAAADCDSTtAAAYhXpUWHRSYXcgcHJvZmlsZSB0eXBlIGV4aWYAAHjarZppciW3kqX/YxW9BDgmB5aD0ax30Mvv7wQpqaT3qsyqrJJSkrx5bwTgwxkcEe7/+78v/B/+1FZLKNV7G61F/pRRRpr80OPPn5/vFsv39/fnRpu/r/7t9cDP6/sp8VLme/75h3Z/vvMxi/WvD3j5fX39/fXg++eH1H8v9PsPXPj7k3Vn/fz7vv57oZx+Xrff38P4/dws/2E7v/+n/XvZ34v/8/fiBONUrpdTSDdbjvyddJfMCnLPk+/623LSm3L+8xX+/PvYhT9//Efw2vpzi3+LXZy/78h/D0WI7fcN7R8x+n3d6j9e/+OCitB/XJH98WP6+z+890cY/zV2753+3v3Z3SyNSLXwu6k/Qmg/FzlsrPxEo/Hl/F/52b+vwVdni5tbHbK5+NrBhiWizf3t2LRn9/u+bbPEkm5yvqe0U/5e69nTSPtLStGXveR55BPIRcqbrGVeTn+uxb77ju9+2zp3PsY7k3ExcvmvX+Hfvfg/+frzQu+pdM0UzLa+WLGupJpmGcqc/uZdpMDeb0zrF9/vK/yZ1r/+KLGZDNYvzJ0Nzrh+LrGq/VVb+ctz5n01lhB/kmx+fi9AiLh3ZTGWyUBslqs1i56SmxHHTn4mK0+5pEUGrNZ0LDxyk3MjOT3p3nzG7XtvqunnZaCFRNTcspOakSfJKqVSP146NTRrBo9qBZa89jrqbLmVVltr3oRR07MXr97cvfvw2XMvvfbWvfc++hxpZCCsjjY8jD7GmJObTi49+fTkHXOutPIqq662fPU11tyUzy677rZ99z32POnkQ/ufdjycfsaZ1y6ldMutt12//Y47H7X28iuvvvb89Tfe/DNrv1n9e9bsH5n7r7Nmv1lTxsr3Pv8ra7zs/sclTHBSlTMyloqRcVcGBE7KWexWSlLmlLM4BFc1k
@cryocaustik
cryocaustik / PythonicSlack.py
Last active October 8, 2018 19:48
python script to apply dark theme to the latest Slack Chat app
import requests
import os
class PythonicSlack():
"""Identified latest version of Slack App and applies dark theme to it.
Raises:
Exception: Exception raised in the event that the Slack Root directory is not found
Exception: Exception is raised in event that the Slack App directory is not found in the Slack Root direcotry
ValueError: Exception is raised in the event that the slack theme is blank