Skip to content

Instantly share code, notes, and snippets.

View sapslaj's full-sized avatar

Justin Roberson sapslaj

View GitHub Profile
[Desktop Entry]
Name=Discord Canary
StartupWMClass=discord
Comment=All-in-one voice and text chat for gamers that's free, secure, and works on both your desktop and phone.
GenericName=Internet Messenger
Path=/opt/DiscordCanary
Exec=/usr/bin/DiscordCanary
Icon=/opt/DiscordCanary/discord.png
Type=Application
StartupNotify=true
This utilizes blns to cram strings through the 'widen' gem.
The first line is the original string, the second, the 'widened' string, the third, the 'narrowened' string
Test strings
Scunthorpe General Hospital
Scunthorpe General Hospital
Scunthorpe General Hospital
$100% true
@sapslaj
sapslaj / daemonss.rb
Last active March 3, 2016 01:27
Daemonss.
class Daemon
def self.run!(options = {}, &block)
new(options, &block).run!
end
def initialize(options = {}, &block)
check_pid
daemonize
write_pid
trap_signals
@sapslaj
sapslaj / config_database.php
Last active January 23, 2016 00:39
Install Koel
<?php
return [
/*
|--------------------------------------------------------------------------
| PDO Fetch Style
|--------------------------------------------------------------------------
|
| By default, database results will be returned as instances of the PHP
{
"upload_date":"20151022",
"extractor":"youtube",
"height":1080,
"like_count":6121956,
"duration":367,
"fulltitle":"Adele - Hello",
"id":"YQHsXMglC9A",
"requested_formats":[
{
@sapslaj
sapslaj / downloader.rb
Last active December 8, 2015 16:11
youtube-dl.rb example getting the filename
def download(url)
video = YoutubeDL.download(url)
video.filename # => "Adele - Hello-YQHsXMglC9A.f137.mp4"
video_with_title = Youtube.download(url, output: '%(title)s.%(ext)s')
video_with_title.filename # => "Adele - Hello.mp4"
title = YoutubeDL::Runner.new(url, get_title: true).run
title # => "Adele - Hello"
end
@sapslaj
sapslaj / easy_fixtures.rb
Created November 6, 2015 14:49
Very simple test fixture implementation.
# Put this in your test_helper or spec_helper and add fixtures to 'fixtures.yml'
def fixture(*keys)
@fixtures ||= YAML.load(File.read(File.join(File.dirname(__FILE__), 'fixtures.yml')))
last_path = @fixtures
keys.each { |key| last_path = last_path[key] }
last_path
end
@sapslaj
sapslaj / collapse.js
Last active December 9, 2015 15:11
Equal Height Columns - Solution for http://codepen.io/blinkygab/pen/ohdaG using flexboxes
(function(){var o=['overflow-x','fast','inherit'],w=0;if(!$){if(Δ){Δ.addRealFunctionalityOnTheFly();};};function c(t){s=$(t);if(w==0){w=s.css('width');};if(s.css('display')!='none'){s.css(o[0], 'hidden');s.animate({width: '0%'},{complete:function(){s.hide(o[1]);}});}else{s.show(o[1]);s.animate({width: w});s.css(o[0],o[2]);}}$('.collapse-toggle').click(function(){c($(this).data('target'));});})();
@sapslaj
sapslaj / pls.plugin.zsh
Last active August 29, 2015 14:28
A ZSH plugin with some common aliases
_PLS_REMOVE="rm -rf"
alias rmrf=_PLS_REMOVE
alias del=_PLS_REMOVE
alias delete=_PLS_REMOVE
alias remove=_PLS_REMOVE
_PLS_COPY="cp -R"
alias copy=_PLS_COPY
alias cpr=_PLS_COPY
@sapslaj
sapslaj / Gemfile
Last active November 9, 2015 06:33
The base Gemfile I use for most Rails projects
source 'https://rubygems.org'
# Backend Gems
gem 'rails'
gem 'sqlite3'
gem 'sass-rails'
gem 'uglifier'
gem 'coffee-rails'
gem 'jbuilder'
gem 'sorcery'