Skip to content

Instantly share code, notes, and snippets.

View jorinvo's full-sized avatar

Jorin jorinvo

View GitHub Profile
@jorinvo
jorinvo / stringFun.js
Last active January 4, 2016 04:08
some string fun
function alphabetSoup(str) {
return str.split(' ').map(function(word) {
var parts = word.substr(1,word.length-2).split('')
.sort(function(){ return Math.random(); })
.join('');
return word[0] + parts + word[word.length-1];
}).join(' ');
}
function rollercaster(str) {
@jorinvo
jorinvo / code.js
Last active December 22, 2015 04:38
Some refactoring. What is nicer?
var passport = require('passport');
var BasicStrategy = require('passport-http').BasicStrategy;
var config = require('./config');
passport.use(new BasicStrategy(function(user, pass, done) {
if (user !== config.auth.user) {
return done(null, false, {
message: 'Unknown user ' + user
});
}
var IncomingForm = require('formidable');
var util = require('util');
var EventEmitter = require('events').EventEmitter;
var GridStore = require('mongodb').GridStore;
var pauseStream = require('pause-stream');
var ObjectID = require('mongodb').ObjectID;
function IncomingFormGridFS(options) {
if(!(this instanceof IncomingFormGridFS)) return new IncomingFormGridFS(options);
@jorinvo
jorinvo / bubble.html
Created September 1, 2013 11:29
some bubble fun
<title>some bubble fun</title>
<style>
body {
font-family: Arial;
padding-top: 10%; padding-left: 30%;
}
@jorinvo
jorinvo / getFunky.coffee
Created July 2, 2013 23:33
some experimentation with functional programming. partial application and composition is awesome! after writing it in js I felt like rewriting in coffescript. its really nice to get rid of all the `function` and `return` keywords. And [splats](http://coffeescript.org/#splats) are damn useful when you work with the arguments object.
_ =
pop: (ctx) ->
Array::pop.call ctx
slice: (args..., ctx) ->
Array::slice.apply ctx, args
reduce: (args..., ctx) ->
Array::reduce.apply ctx, args
@jorinvo
jorinvo / protectMail.html
Last active December 18, 2015 03:48
protectMail - a simple jQuery plugin to protect emails from spam bots using data-attributes.
<head>
<title>protectMail Examples</title>
<script src="http://code.jquery.com/jquery-2.0.2.min.js"></script>
<script src="protectMail.js"></script>
</head>
<body>
<h1>protectMail Examples</h1>
<p>
@jorinvo
jorinvo / commands.md
Last active December 18, 2015 00:09
Scripts um Hubot auf Uberspace zu installieren.Für mehr Infos: http://jorinvogel.wordpress.com/2013/06/02/hubot-auf-uberspace-installieren/
  • hubot image me query - The Original. Queries Google Images for query and returns a random top result.

  • hubot animate me query - The same thing as image me, except adds a few parameters to try to return an animated GIF instead.

  • hubot mustache me url - Adds a mustache to the specified URL.

  • hubot mustache me query - Searches Google Images for the specified query and mustaches it.

  • hubot map me query - Returns a map view of the area returned by query.

  • hubot math me expression - Calculate the given expression.

  • hubot convert me expression to units - Convert expression to given units.

@jorinvo
jorinvo / un-bot.md
Last active December 18, 2015 00:08
commands for un-bot
  • un-bot image me query - The Original. Queries Google Images for query and returns a random top result.

  • un-bot animate me query - The same thing as image me, except adds a few parameters to try to return an animated GIF instead.

  • un-bot mustache me url - Adds a mustache to the specified URL.

  • un-bot mustache me query - Searches Google Images for the specified query and mustaches it.

  • un-bot map me query - Returns a map view of the area returned by query.

  • un-bot math me expression - Calculate the given expression.

  • un-bot convert me expression to units - Convert expression to given units.

@jorinvo
jorinvo / fizzbuzz.js
Created June 2, 2013 00:06
Try to write FizzBuzz with as little code as possible. Language doesn't matter. This one in javascript is 66 chars.
for(n=0;++n<101;){console.log((n%3?'':'Fizz')+(n%5?'':'Buzz')||n)}
@jorinvo
jorinvo / gist:4275139
Created December 13, 2012 09:06
Generate file from YAML data with mustache layout.
#!/usr/bin/ruby
require 'mustache'
require 'yaml'
LAYOUT = 'layout.html'
DATA = 'data.yaml'
OUT = 'index.html'