Skip to content

Instantly share code, notes, and snippets.

@Elyx0
Elyx0 / nginx.conf
Last active August 29, 2015 14:25 — forked from Stanback/nginx.conf
Example Nginx configuration for serving pre-rendered HTML from Javascript pages/apps using the Prerender Service (https://github.com/collectiveip/prerender). Instead of using try_files (which can cause unnecessary overhead on busy servers), you could check $uri for specific file extensions and set $prerender appropriately.
server {
listen 80;
listen [::]:80;
server_name yourserver.com;
root /path/to/your/htdocs;
error_page 404 /404.html
index index.html;
@Elyx0
Elyx0 / sim
Created August 26, 2015 04:21
(a,b) => {
var h = a.length > b.length ? a : b;
var l = h==a ? b.split('') : a.split('');
return h.split('').reduce((x,y,i)=> {
return y == l[i] ? ++x: x;
},0) / h.length;
}("boat","coat")
@Elyx0
Elyx0 / rnrflogic1.js
Created June 21, 2016 18:52
RNRF Header+Component.js
//
// Gif of the page: http://i.imgur.com/fGZGkKB.gifv
//
'use strict';
import React, {Component} from 'react';
import {ScrollView, StyleSheet, TextInput, Text, View} from 'react-native';
@Elyx0
Elyx0 / rnrflogic2.js
Created June 21, 2016 18:53
RNRF Header+Component Part2
'use strict';
import React, {Component} from 'react';
import {StyleSheet, Image, Text, TouchableWithoutFeedback, TouchableOpacity, View} from 'react-native';
import { Actions } from 'react-native-router-flux';
import { connect } from 'react-redux';
import LinearGradient from 'react-native-linear-gradient';
import Icon from 'react-native-vector-icons/FontAwesome';
import MaterialIcon from 'react-native-vector-icons/MaterialIcons';
import cssConfig from '../styles/config';
@Elyx0
Elyx0 / Uploader.m
Last active July 8, 2016 15:23
RNRF Uploader.m
#import "Uploader.h"
#import "RCTLog.h"
@implementation UploadParams
@end
@interface Uploader()
@property (copy) UploadParams* params;
@Elyx0
Elyx0 / Jabberwacky.js
Created March 11, 2017 09:19
Nodejs Jabberwacky chatbot
#!/usr/bin/env node
// usage: ./jabberwacky.js "Hello sir"
var fs = require('fs');
var cheerio = require('cheerio');
var arg = process.argv;
var fetch = require('node-fetch');
var search = arg.slice(2,arg.length).join(' ').replace(/Curvebot1?/,'');
var previous = fs.readFileSync('./conv.txt');
var def = {
// Simplified from: https://github.com/Elyx0/rosenblattperceptronjs/blob/master/src/Perceptron.js
class Perceptron {
constructor(bias=1,learningRate=0.1,weights=[]) {
this.bias = bias;
this.learningRate = learningRate;
this.weights = weights;
this.trainingSet = [];
}
init(inputs,bias=this.bias) {
@Elyx0
Elyx0 / uncurrymixins.js
Created June 11, 2017 23:01
uncurry+mixins
// Loops over the list of functions and call
// the next with the previous result.
//
// If next is not a function,
// it's an additional argument to the previous result
const chain = (...fns) => start => fns
.reduce((res,next) => typeof next == 'function' ?
next(res) :
res(next)
@Elyx0
Elyx0 / VrChatCheckUserPresence.js
Created January 31, 2018 21:58
VrChatCheckUserPresence
// To paste in the chrome console in the VrChat/Home Page
function beep() {
var snd = new Audio("data:audio/wav;base64,//uQRAAAAWMSLwUIYAAsYkXgoQwAEaYLWfkWgAI0wWs/ItAAAGDgYtAgAyN+QWaAAihwMWm4G8QQRDiMcCBcH3Cc+CDv/7xA4Tvh9Rz/y8QADBwMWgQAZG/ILNAARQ4GLTcDeIIIhxGOBAuD7hOfBB3/94gcJ3w+o5/5eIAIAAAVwWgQAVQ2ORaIQwEMAJiDg95G4nQL7mQVWI6GwRcfsZAcsKkJvxgxEjzFUgfHoSQ9Qq7KNwqHwuB13MA4a1q/DmBrHgPcmjiGoh//EwC5nGPEmS4RcfkVKOhJf+WOgoxJclFz3kgn//dBA+ya1GhurNn8zb//9NNutNuhz31f////9vt///z+IdAEAAAK4LQIAKobHItEIYCGAExBwe8jcToF9zIKrEdDYIuP2MgOWFSE34wYiR5iqQPj0JIeoVdlG4VD4XA67mAcNa1fhzA1jwHuTRxDUQ//iYBczjHiTJcIuPyKlHQkv/LHQUYkuSi57yQT//uggfZNajQ3Vmz+Zt//+mm3Wm3Q576v////+32///5/EOgAAADVghQAAAAA//uQZAUAB1WI0PZugAAAAAoQwAAAEk3nRd2qAAAAACiDgAAAAAAABCqEEQRLCgwpBGMlJkIz8jKhGvj4k6jzRnqasNKIeoh5gI7BJaC1A1AoNBjJgbyApVS4IDlZgDU5WUAxEKDNmmALHzZp0Fkz1FMTmGFl1FMEyodIavcCAUHDWrKAIA4aa2oCgILEBupZgHvAhEBcZ6joQBxS76AgccrFlczBvKLC0QI2cBoCFvfTDAo7eoOQInqDPBtvrDEZBNYN5xwNwxQRfw8ZQ5wQVLvO8OYU+mHvFLlDh05Mdg7BT6YrRPpCBznMB2r//xKJjyyOh+cImr2/4doscwD6neZju
@Elyx0
Elyx0 / cloudSettings
Last active April 17, 2019 17:01
Visual Studio Code Settings Sync Gist
{"lastUpload":"2019-04-17T00:23:58.949Z","extensionVersion":"v3.2.8"}