Skip to content

Instantly share code, notes, and snippets.

@rickycodes
rickycodes / shrug.sh
Last active November 23, 2015 17:45
idk() {
local shrugs=("¯\_(ツ)_/¯" "¯\(°_°)/¯" "¯\(°_o)/¯" "┐(°_°)┌")
local shrug=${shrugs[$RANDOM % ${#shrugs[@]}]}
pbcopy <<< "${shrug}" && echo "${shrug} copied to clipboard"
}
alias shrug=idk
define([
'intern!object',
'intern/chai!assert',
'require'
], function (registerSuite, assert, require) {
function getScrollPosition(context) {
return context.remote
.execute(function () {
y = window.pageYOffset;
@rickycodes
rickycodes / gist:10682109
Last active August 29, 2015 13:59
alignment for facespac.es
(function(){
var css = '#video-wrapper table {';
css+= 'width: 101px;';
css+= 'height: 101px;';
css+= 'border: 1px solid red;';
css+= 'position: absolute;';
css+= 'top: 0;';
css+= 'z-index: 999;';
css+= '}';
@rickycodes
rickycodes / gist:4732521
Last active December 12, 2015 06:49
Cache bust your apps
$(function(){
var bust = Date().now();
var resources = [
{ html : '<script>', attr : 'src', link : 'js/init.js?v=' }
, { html : '<link rel="stylesheet">', attr : 'href', link : 'css/style.css?v=' }
];
$.each(resources, function(i,v) {
$(v.html).attr(v.attr, v.link + bust).appendTo( 'body' );
});
@rickycodes
rickycodes / gist:4676800
Created January 30, 2013 20:47
b-ot uptime
function uptime(msg) {
var s = process.uptime();
const h = Math.floor( s / ( 60 * 60 ) );
s -= h * ( 60 * 60 );
const m = Math.floor( s / 60 );
s -= m * 60;
msg.reply('I have been running for %s hours, %s minutes and %s seconds.', h, m, s);
}
@rickycodes
rickycodes / gist:4552795
Last active December 11, 2015 05:29
desc ircjsbot plugin
/**
* @module desc
* This module fetches titles + descriptions for sites shared in a channel IF the message is simply an URL
* This module is also an example of how to use cheerio to `parse` html.
* Dependencies not included in ircjsbot: cheerio + request (request because it follows redirects, which the entire internet is build on, apparently)
*/
"use strict";
const irc = require("irc-js");
var gol = [ " _,...,_"
, " .'@/~~~\\@'."
, " //~~\\___/~~\\\\"
, "|@\\__/@@@\\__/@|"
, "|@/ \\@@@/ \\@|"
, " \\__/~~~\\__//"
, " '.@\\___/@.'" ];
@rickycodes
rickycodes / gist:4504670
Created January 10, 2013 18:45
multiline flair.js
/**
* @module flair
*/
const irc = require( "irc-js" )
const FLAIR =
[ [ /\balligator\b/i, "---,==,'<" ]
, [ /\bshrugs\b/i, "¯\\_(ツ)_/¯" ]
, [ /\by u\b/i, "(屮'Д')屮" ]
, [ /\bdentata\b/i, [ "(▼▼▼▼▼▼▼▼▼)"
@rickycodes
rickycodes / gist:4125586
Created November 21, 2012 15:51
Greyscale a thing
.thing {
filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale");
filter: gray;
-webkit-filter: grayscale(100%);
}
@rickycodes
rickycodes / gist:4004078
Created November 2, 2012 20:19
flipString kickFlip
function flipString( str ) {
return str.toLowerCase().split( '' ).map( function( c ) {
return chars[ c ] ? chars[ c ] : c
}).reverse().join('')
}
function kickFlip( str ) {
return '(╯°□°)╯︵' + flipString( str )
}