Skip to content

Instantly share code, notes, and snippets.

Thorsten thorsteneckel

Block or report user

Report or block thorsteneckel

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@aras-p
aras-p / preprocessor_fun.h
Last active Nov 14, 2019
Things to commit just before leaving your job
View preprocessor_fun.h
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
View ghe-revealer.rb
#!/usr/bin/sudo ruby
#
# revealer.rb -- Deobfuscate GHE .rb files.
#
# This is simple:
# Every obfuscated file in the GHE VM contains the following code:
#
# > require "ruby_concealer.so"
# > __ruby_concealer__ "..."
@tadast
tadast / ssl_puma.sh
Last active Nov 11, 2019 — forked from trcarden/gist:3295935
localhost SSL with puma
View ssl_puma.sh
# 1) Create your private key (any password will do, we remove it below)
$ cd ~/.ssh
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
View Ruby Lambdas.md

Lambda: standard

# Creating a lambda
l = lambda { |name| "Hi #{name}!" }

# Executing the lambda
l.call("foo") # => Hi foo!
View yardoc_cheatsheet.md

YARD CHEATSHEET http://yardoc.org

cribbed from http://pastebin.com/xgzeAmBn

Templates to remind you of the options and formatting for the different types of objects you might want to document using YARD.

Modules

# Namespace for classes and modules that handle serving documentation over HTTP
@wtaysom
wtaysom / where_is.rb
Created Sep 23, 2011
A little Ruby module for finding the source location where class and methods are defined.
View where_is.rb
module Where
class <<self
attr_accessor :editor
def is_proc(proc)
source_location(proc)
end
def is_method(klass, method_name)
source_location(klass.method(method_name))
@iambibhas
iambibhas / scopes.txt
Last active Oct 30, 2019
Sublime Text 2: Snippet scopes
View scopes.txt
Here is a list of scopes to use in Sublime Text 2 snippets -
ActionScript: source.actionscript.2
AppleScript: source.applescript
ASP: source.asp
Batch FIle: source.dosbatch
C#: source.cs
C++: source.c++
Clojure: source.clojure
CoffeeScript: source.coffee
@speric
speric / poodir-notes.md
Last active Oct 25, 2019
Notes From "Practical Object-Oriented Design In Ruby" by Sandi Metz
View poodir-notes.md

Chapter 1 - Object Oriented Design

The purpose of design is to allow you to do design later, and it's primary goal is to reduce the cost of change.

SOLID Design:

  • Single Responsibility Principle: a class should have only a single responsibility
  • Open-Closed Principle: Software entities should be open for extension, but closed for modification (inherit instead of modifying existing classes).
  • Liskov Substitution: Objects in a program should be replaceable with instances of their subtypes without altering the correctness of that program.
  • Interface Segregation: Many client-specific interfaces are better than one general-purpose interface.
@ndarville
ndarville / webm.md
Last active Oct 3, 2019
4chan’s guide to converting GIF to WebM - https://boards.4chan.org/g/res/41212767
View webm.md

Grab ffmpeg from https://www.ffmpeg.org/download.html

It's a command line tool which means you will have to type things with your keyboard instead of clicking on buttons.

The most trivial operation would be converting gifs:

ffmpeg -i your_gif.gif -c:v libvpx -crf 12 -b:v 500K output.webm
  • -crf values can go from 4 to 63. Lower values mean better quality.
  • -b:v is the maximum allowed bitrate. Higher means better quality.
@cupakromer
cupakromer / books_controller.rb
Last active Sep 22, 2019
Rails 4 Standard CRUD Controller
View books_controller.rb
# No flash messages are set with this controller.
#
# This is a fairly basic / bare controller which does only the basic CRUD.
class BooksController < ApplicationController
respond_to :html, :xml, :json
before_action :set_book, only: [:show, :edit, :update, :destroy]
def index
respond_with @books = Book.all
You can’t perform that action at this time.