Skip to content

Instantly share code, notes, and snippets.

@rashfael
rashfael / mastodon-full-width-columns.user.js
Last active April 28, 2017 20:32
Tampermonkey script: Mastodon full width columns
// ==UserScript==
// @name Mastodon full width columns
// @namespace http://isobeef.org/
// @version 0.1
// @description Mastodon full width columns
// @author rash <rashfael@isobeef.org>
// @updateUrl https://gist.github.com/rashfael/b0fa9c7ffff1cf44bc7639269440a026/raw/mastodon-full-width-columns.user.js
// @downloadUrl https://gist.github.com/rashfael/b0fa9c7ffff1cf44bc7639269440a026/raw/mastodon-full-width-columns.user.js
// @match https://chaos.social/web/*
// @grant GM_addStyle
@rashfael
rashfael / backup.sh
Created March 21, 2017 18:32
backupscripts
#!/bin/bash
# Backup script to save important IsoBeef data on Hetzner's backup service.
#
# Usage:
# ./backup
#
# Written by BOFH Lyse, licensed under WTFPL.
#
# References:
# http://www.nongnu.org/rdiff-backup/examples.html
function snakeToCamel(str) {
var parts = str.split('_');
return parts.reduce(function (p, c) {
return p + c.charAt(0).toUpperCase() + c.slice(1);
}, parts.shift());
}
function toCamelCase(object, exceptions) {
exceptions = exceptions || [];
DELIMITER $$
CREATE PROCEDURE create_user(username TEXT, passwordhash TEXT)
BEGIN
DECLARE temp TEXT;
SELECT user FROM mysql.user WHERE user = username INTO temp;
IF temp = username THEN
SIGNAL SQLSTATE '45002' SET MESSAGE_TEXT = 'username already exists';
ELSE
SET @s = CONCAT('CREATE USER \'', username, '\'@localhost IDENTIFIED BY PASSWORD \''+passwordhash+'\'');
PREPARE stmt_create FROM @s;
@rashfael
rashfael / soup_nfsw_userscript.js
Created February 14, 2015 22:22
soup.io show nfsw
// ==UserScript==
// @name soup.io always nsfw
// @namespace http://isobeef.org
// @version 0.1
// @description always shows all the unsafe pictures on soup
// @author rashfael
// @match http://*.soup.io/*
// @exclude http://*.soup.io/remote/*
// @exclude http://*.soup.io/frames
// @grant none
@rashfael
rashfael / controller
Last active December 11, 2015 04:38 — forked from anonymous/gist:4546270
module.exports = class ReportController extends Controller
historyURL: 'reports'
index: ->
collection = new Reports()
collection.fetch()
@view = new ReportListView
collection: collection
@rashfael
rashfael / formHelpers.jade
Created October 12, 2012 08:34
form helper jade
mixin textfield(options)
.control-group
label.control-label(for=options.name)= options.label
.controls
div(class=options.append ? 'input-append' : '')
- var classArr = [];
- if(options.size)
- classArr.push(options.size);
- else
- classArr.push('span8');
module.exports = class Crud
constructor: (app) ->
app.get "/api/#{@prefix}", @list
app.post "/api/#{@prefix}", @add
app.get "/api/#{@prefix}/:id", @item
app.put "/api/#{@prefix}/:id", @update
app.delete "/api/#{@prefix}/:id", @delete
{exec} = require 'child_process'
{spawn} = require 'child_process'
{fork} = require 'child_process'
os = require 'os'
if os.platform() is 'win32'
coffee = 'coffee.cmd'
brunch = 'brunch.cmd'
else
coffee = 'coffee'
@rashfael
rashfael / getter.coffee
Created January 16, 2012 23:21
mongoose: Getter gets called with undefined parameter
mongoose = require 'mongoose'
TestSchema = new mongoose.Schema {
number:
type: Number
set: (x) -> return x/2
get: (x) ->
console.log 'getter called with undefined' if not x?
x*2 if x?
}