Skip to content

Instantly share code, notes, and snippets.

View oranj's full-sized avatar
👁️‍🗨️
Observing

Raymond Roeming oranj

👁️‍🗨️
Observing
View GitHub Profile
@oranj
oranj / Chatroom.md
Last active December 21, 2016 15:55
@oranj
oranj / url2ascii.php
Last active December 15, 2015 14:08
#!/usr/bin/php
<?php
/**
* Calibration: depending on your fonts and terminal colors, you may want to change these
*/
global $PIXELS, $COLORS, $HSV_COLORS;
$YSCALE = 12;
$XSCALE = 5;
@oranj
oranj / pinch.jquery.js
Created March 29, 2013 15:40
Touch event pinch / zoom gesture library. jQuery based
(function($) {
var TOUCH_START = 'touchstart';
var TOUCH_MOVE = 'touchmove';
var TOUCH_END = 'touchend';
var num_touch_points = function(e) {
var o = e.originalEvent;
if (o.hasOwnProperty('touches')) {
return o.touches.length;
@oranj
oranj / attrs.js
Created February 20, 2013 21:33
Lets you get a list of values of the provided attributes.
$.prototype.attrs = function(attr) {
var o = [];
$(this).each(function() {
var v = $(this).attr(attr);
if (v) {
o.push(v);
}
});
return o;
}
<?php
class Accessible {
const inst_prefix = 'inst_';
const stat_prefix = 'stat_';
const trans_prefix = 'trans_';
private $data = array();
(function($) {
var default_prefs = {
"active_index" : 0,
"active_class" : 'active'
};
var prefs = {};
var methods = {
"init" : function(_prefs) {
var that = this;
@oranj
oranj / _bem.scss
Created December 3, 2015 20:40
BEM SASS Mixins
// BEM mixins (Block, Element, Modifier)
//
// Just google if you're confused.
@mixin block($name) {
@at-root .#{$name} {
@content;
}
}
@oranj
oranj / mc_modloader.sh
Created November 8, 2012 04:54
Automagically Loads Minecraft Mod
This is a mac specific script to load a mod into minecraft. In the terminal, run:
./mc_modloader.sh ModName.zip.
It will make a backup of your current minecraft jar, and attempt to merge the mod into it.
@oranj
oranj / tab.sh
Created October 11, 2012 15:46
Engine to watch files
#This file lists a bunch of callbacks for file changed events.
#@ /Users/raym/Sites/myon/includes/content/js/reader/player.3.2.js
java -jar $HOME/Sites/myon/server/utils/rm/lib/yuicompressor-2.4.7.jar /Users/raym/Sites/myon/includes/content/js/reader/player.3.2.js -o /Users/raym/Sites/myon/includes/content/js/reader/player.min.3.2.js;
echo "Hello world";
@oranj
oranj / best_fit.php
Created October 1, 2012 21:28
Best fit
function calculate_line($x1, $y1, $x2, $y2, $dataset) {
$m = ($y2 - $y1) / ($x2 - $x1);
$b = ($y1 - $m * $x1);
$total_diff = 0;
foreach ($dataset as $inf) {
list($x, $y) = $inf;
$yl = $m * $x + $b;
$diff[$x] = $yl - $y;
$total_diff += abs($diff[$x]);