This file contains 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
require('fs').writeFile( | |
require('path').join(process.cwd(), '/.tob.log'), | |
JSON.stringify(_DATA_, null, 4), | |
(err)=>{if (err) console.log(err)} | |
) |
This file contains 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
import React from 'react'; | |
import Image from 'next/image'; | |
export function Slider() { | |
const sliderRef = React.useRef<HTMLDivElement>(null); | |
const [activeIndex, setAciveIndex] = React.useState(0); | |
function setActive(i: number) { | |
sliderRef.current?.scrollTo((sliderRef.current.scrollWidth / quotes.length) * i, 0); | |
} |
This file contains 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
const debug = true; | |
function debugLog(message) { | |
if (debug) { | |
console.log(message); | |
} | |
} | |
let sharedCached: { [key: string]: IKachelerCacheItem<unknown> } = {}; | |
export const kacheler = { |
This file contains 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
javascript:!function(){const SLACK_BOT_TOKEN="your slack bot token";async function get(a=[],b){let c=`https://slack.com/api/conversations.history?token=${SLACK_BOT_TOKEN}&channel=CJTD5RP7Y`;b&&(c+="&cursor="+b);const d=await fetch(c),e=await d.json();return a=[...a,...e.messages],e.has_more?await get(a,e.response_metadata.next_cursor):a}async function init(){const a=await get(),b=a.reduce((a,b)=>{try{const c=b.text.split("com/track/")[1].split("?")[0],d=`https://open.spotify.com/track/${c}`;a.arr.push(d),a.str+=`${d}\n`}catch{}return a},{arr:[],str:""});console.log(b);var c=window.open();const d=c.document.createElement("textarea");d.value=b.str,d.style="width:100%;height: 600px;font-size: 16px",c.document.body.innerHTML=`<p>${b.arr.length} tracks</p>`,c.document.body.appendChild(d)}init();}(); |
This file contains 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
javascript:!function(){let e=prompt("Ange namn på listan du vill kopiera");e&&(e=e.toLowerCase().trim());let t=$(".list-header-name-assist").filter((t,n)=>n.innerHTML.toLowerCase()===e).first().closest(".list").find(".list-card-title").contents().toArray().filter(e=>3===e.nodeType).map(e=>e.data).reduce((e,t)=>(e.text=`${e.text}${t}\n`,e),{html:"",text:""});var n=window.open();const o=n.document.createElement("textarea");o.value=t.text,o.style="width:100%;height: 600px;font-size: 16px",n.document.body.appendChild(o),o.select(),n.document.execCommand("copy")}(); |
This file contains 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
[HttpGet] | |
public HttpResponseMessage ReturnRawString() | |
{ | |
return new HttpResponseMessage() | |
{ | |
Content = new StringContent( | |
Something.CreateString(), | |
Encoding.UTF8, | |
"text/plain" | |
) |
This file contains 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
[HttpGet] | |
public IHttpActionResult CompareJsons() | |
{ | |
var jsonString1 = "{\"key1\" : [{a:\"ABC\"}, {b:\"ABd\"}, ], \"key2\":\"DEF\"}"; | |
var jsonString2 = "{ \"key2\":\"DEF\" , \r\n \t \"key1\" : [{a:\"ABC\"}, {b:\"ABd\"}] }"; | |
var obj1 = JToken.Parse(jsonString1); | |
var obj2 = JToken.Parse(jsonString2); | |
var comparer = new JTokenEqualityComparer(); |
This file contains 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
public class ExportController | |
{ | |
[HttpGet] | |
public HttpResponseMessage AllUsers() | |
{ | |
var csv = new StringBuilder(); | |
var fileName = $"export {DateTime.Now.ToString("yyyy-MM-dd--HH-mm-ss")}.csv"; | |
var result = new HttpResponseMessage(HttpStatusCode.OK); | |
var excelDateTimeFormat = "yyyy-MM-dd HH:mm:ss"; // format datetimes so excel can parse them |
This file contains 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
public class Import | |
{ | |
private static object ImportLock = new object(); | |
private static DateTime LastImport = DateTime.MinValue; | |
public static ImportInfo Import() | |
{ | |
lock (ImportLock) | |
{ | |
if (DateTime.Now.AddSeconds(-10) < LastImport) |
This file contains 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
{ | |
rules: { | |
"capitalized-comments": "off", | |
"multiline-comment-style": "off", | |
"no-console": "off", | |
"no-await-in-loop": "off", | |
"quote-props": "off", | |
"sort-keys": "off", | |
"arrow-parens": "off", | |
"no-tabs": "off", |
NewerOlder