Skip to content

Instantly share code, notes, and snippets.

View Kreijstal's full-sized avatar
↗️

Kreijstal Kreijstal

↗️
View GitHub Profile
/<\/?\w[\w\d]*(?:([^>"']|"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'))*>|<!--[\S\s]*?-->/
function UnicodeToUTF8Array(UnicodeValue) {//Only 1 unicode value!!!!!! //Char Number Range as called from the RFC
//Converts Unicode number or character.toCharCodeAt() to an "UTF8 array"
//After this has been done, converting to UTF-8 is just trivial, just call UTF8ArrayToUTF8
//JavaScript cannot "convert" strings to UTF-8 so we're just using byte arrays to save the information in case we need to save it to a file
/*Q:So why converting from Unicode to UTF-8 takes two functions? How is that a good Idea?
A:Well, I just thought that it could be really nice for debugging purposes, also knowing what the hell the String is converted to before being converted to*/
var thearr = [];
if (UnicodeValue > 0x7FFFFFFF) {
throw new Error("Value cannot be greater than " + 0x7FFFFFFF);
/*You should remove this, if you don't like errors much, it will be annoying to enclose everything
How to understand brainfuck?
It's easy, imagine a list, this lists has all it's values (contents) default to 0.
The length of the array (the list) depends on the system where brainfuck is run, in some systems it's a loop, in others the array can extend undefinetively
Now there are commands you use to change those values and move the pointer.
The pointer is the index of the array you're currently using.
There are 4 basic operators that are easy to learn
+ : Adds +1 on the index the pointer indicates
- : Decreases -1 on the index the pointer indicates
@Kreijstal
Kreijstal / Cebollachanpost.js
Last active August 29, 2015 14:04
Continues to send requests, to see when cebollachan is up again.
function getForm(asdf){
var div=document.createElement('div');
div.innerHTML=asdf;
return div.getElementsByTagName("form")[0];
}
function removeElement(element){
element&&element.parentNode.removeChild(element);
}
function HTTPRequestRetry(link,success,requesttype,post,headers,attemptsleft,failure){
@Kreijstal
Kreijstal / makeElem.js
Created August 1, 2014 19:12
Creates a new element.
function makeElem(elem, attributes, childnodes) {
var e = document.createElement(elem),l;
for (var a in attributes) {
if (a == "style") {
for (var d in attributes[a]) {
e.style[d] = attributes[a][d];
}
continue;
}
if (a == "__properties") {
@Kreijstal
Kreijstal / Notify,js
Created August 5, 2014 00:42
Notify wrapper
var Notify=function (w, d) {
'use strict';
function Notify(title, options) {
if (typeof title !== 'string') {
throw new Error('Notify(): first arg (title) must be a string.');
}
function Queue(){
// initialise the queue and offset
this.queue = [];
this.offset = 0;
}
// Returns the length of the queue.
Queue.prototype.getLength = function(){
return (this.queue.length - offset);
}
//States
var states = [{
'name': 'working',
'initial': true,
'events': {
'bored': 'coffee',
'call_for_meeting': 'meeting',
}
}, {
'name': 'coffee',
@Kreijstal
Kreijstal / getDups.js
Last active August 29, 2015 14:05
Some script to get filenames and images form threads on ponychans
function getDups(){
var outstring="";
for(var i=0;i<dups.length;i++){
console.log(g[dups[i]].post)
outstring+=Object.keys(g[dups[i]].dups).concat(g[dups[i]].post).map(function(a){return ">>"+a}).join('\n')+'\n\n';
}
return outstring
}
http://jsfiddle.net/z9b2m/44/show/ ?!?!?!??
http://jsfiddle.net/ztfv652d/3/
:D
Other jsfiddles:
http://jsfiddle.net/T7Srr/11/
http://jsfiddle.net/gvKtN/6/show
http://jsfiddle.net/HbhXY/6/show/
http://jsfiddle.net/upnMK/4/show/