Skip to content

Instantly share code, notes, and snippets.

View blubbll's full-sized avatar
🔷

B͈̤̖̪̪̱ͅl̯̯̮̼͎̬͚̳̩̖̲u̜̼͉͈̠b͙̬̘̙̱̗̲͙b͍̞̬̬͓̼l̰̪͖̯̼̟̟͈̖͕̜̱̜ͅl̻̗͔̝̭̰͚͇̯̥ blubbll

🔷
View GitHub Profile
var url = location.href.toLowerCase().replace("/default.aspx","").split('/').pop();
if(url === "") url = location.href.toLowerCase().slice(0, -1).split('/').pop();
if(url===location.hostname)url="/";
@blubbll
blubbll / gist:81170467f413188a96ba1abf43a02137
Created January 29, 2019 23:16
two download methods for node
const download = async (url, dest) => new Promise((resolve, reject) => {
console.log(`Downloading ${url} to ${dest}`);
return new Promise((resolve, reject) => {
http.get(url, (res) => {
if (res.statusCode !== 200) {
var err = new Error('File couldn\'t be retrieved');
err.status = res.statusCode;
return reject(err);
}
var chunks = [];
@blubbll
blubbll / es7.js
Created January 30, 2019 02:40
Is the JavaScript Browser evrsion es7?
/**!checkes7 by Blubbll*/
var es7=
void 0!==window.ResizeObserver&&
void 0!==window.MutationObserver;
/*const getBingData = async() => new Promise((resolve, reject) => {
fetch('https://bing.com'
)
.then(function(response) {
if (response.ok)
return response.text();
else
throw new Error('Bild konnte nicht geladen werden');
})
.then(function(html) {
@blubbll
blubbll / path
Created February 5, 2019 05:28
VRChat temporary path
%appdata%\..\LocalLow\VRChat
@blubbll
blubbll / flexbox.js
Last active February 8, 2019 06:42
does the browser support flexboxes?
//https://gist.github.com/davidhund/b995353fdf9ce387b8a2
window.flexbox = function() {
var t = "flex",
e = "-webkit-".concat(t),
l = document.createElement("b");
try {
return l.style.display = e, l.style.display = t, !(l.style.display !== t && l.style.display !== e)
} catch (t) {
return !1
}
function loadScripts(urls, callback) {
var i = 0;
(function loadNextScript() {
if (i < urls.length) {
$3.getScript(urls[i][0]).done(function () {
alert(urls[i][1] + " loaded"); // probably remove in production
++i;
loadNextScript();
});
}
@blubbll
blubbll / windowstuff.cs
Created February 19, 2019 13:06
C# dispatcher // access mainwindow from another class
MainWindow.main.Dispatcher.Invoke(new Action(delegate ()
{
var that = MainWindow.main.lblZuege;
that.Content = zuege;
}));
public static MainWindow main;
public MainWindow()
{
@blubbll
blubbll / identity.cs
Created February 25, 2019 06:08
c# identity fun
res.Write(System.Environment.MachineName);
res.Write(new DirectoryInfo(@"C:\\Users").GetDirectories()
.OrderByDescending(d => d.LastWriteTimeUtc).First());
WindowsPrincipal windowsPrincipal = (WindowsPrincipal)Thread.CurrentPrincipal;
res.Write("username principal" + windowsPrincipal.Identity.Name);
res..ServerVariables["LOGON_USER"]
res.Write(System.Web.HttpContext.Current.User.Identity.Name);
@blubbll
blubbll / webapisession.cs
Created February 28, 2019 08:06
webapi session allow
using System;
using System.Web;
using System.Web.Http;
using System.Web.Http.WebHost;
using System.Web.Routing;
using System.Web.SessionState;
namespace filetransfer
{
public static class webApiConfig