Skip to content

Instantly share code, notes, and snippets.

@sciolist
sciolist / alert.js
Created September 11, 2014 21:32
jQuery.feature
(function ($, window, undefined) {
"use strict";
$.feature('js-alert', function (el, value) {
$(el).click(function () { alert(value); });
});
})(jQuery, window);
@sciolist
sciolist / WKWebView+HideInputAccessoryView.h
Created July 10, 2015 10:26
WKWebView+HideInputAccessoryView
#include <WebKit/WebKit.h>
@interface WKWebView (HideInputAccessoryView)
- (void) setAccessoryViewEnabled:(BOOL)on;
@end
import flash.events.TimerEvent;
class TimerInfo
{
public function new(toInvoke, block)
{
invoke = toInvoke;
blocking = block;
}
@sciolist
sciolist / NPocoFaceting.cs
Created September 18, 2015 17:39
Awful faceting with NPoco and SQL Server 2012
using NPoco;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
namespace NPocoFaceting
{
public class FacetBuilder
{
@sciolist
sciolist / karusell.css
Created April 5, 2011 16:48
Simple jQuery element carousel.
.karusell {
position: relative;
overflow: hidden;
}
.karusell .page.next { z-index: 3; }
.karusell .page.current { z-index: 2; }
.karusell .page {
position: absolute;
background: black;
@sciolist
sciolist / class.js
Created May 10, 2011 23:57
Minimal JavaScript inheritance
function Class() { }
Class.extend = function(data) {
var cls = data.init || function(){};
cls.base = data.__proto__ = this.prototype;
cls.extend = arguments.callee;
cls.prototype = data;
return cls;
};
@sciolist
sciolist / waffles.html
Created March 15, 2012 16:05
Waffles tests
<!DOCTYPE html>
<html>
<head>
<title>Testing</title>
<base href="https://raw.github.com/sciolist/waffles.js/master/www/">
<script type="text/javascript" src="coffee-script.js"></script>
<script type="text/javascript" src="../out/waffles.js"></script>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
<script type="text/javascript" src="scrolls.js"></script>
<script type="text/javascript" src="tableview.js"></script>
@sciolist
sciolist / main.c
Created August 5, 2012 14:09
A little method builder
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <sys/mman.h>
#include <limits.h>
#ifndef PAGESIZE
#define PAGESIZE 4096
#endif
@sciolist
sciolist / example.rb
Created August 16, 2012 20:46
Use some simple ngrams to figure out what method you wanted to call!
require './oh_god_why'
class Object
include FigureItOut
end
str = "hello, world."
puts str.make_upper_case # HELLO, WORLD.
this = "this be some text"
@sciolist
sciolist / bookmarklet
Created September 3, 2012 08:45
Damn..
javascript:Array.prototype.slice.call(document.getElementsByTagName("*")).forEach(function(x)%20{for(var%20i=0;%20i<x.childNodes.length;%20++i)%20{var%20v%20=%20x.childNodes[i];%20if(v.nodeType%20!=%203)%20continue;%20if(!v.textContent.match(/[^\s]/))%20continue;v.textContent%20=%20v.textContent.replace(/[\w%C3%A5%C3%A4%C3%B6%C3%85%C3%84%C3%96]+/g,%20function(t)%20{var%20up%20=%20t[0].toUpperCase()%20==%20t[0];%20var%20vals%20=%20["fuck",%20"shit",%20"damn",%20"hell",%20"cock",%20"cunt",%20"ass"];%20var%20sel%20=%20vals[Math.floor(Math.random()%20*%20vals.length)];if(up)%20sel%20=%20sel[0].toUpperCase()%20+%20sel.substring(1);return%20sel});}});