Skip to content

Instantly share code, notes, and snippets.

Roman Pramberger b1nary

Block or report user

Report or block b1nary

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
View i
#!/bin/bash
if [ $1 = "love" ]; then
if [ "$EUID" -ne 0 ]; then
echo "i have a boyfriend"
else
echo "i love $2 too"
fi
fi
@b1nary
b1nary / index.php
Last active Nov 9, 2017
PHP yield?
View index.php
<?php layout("Title goes here"){ ?>
Content in here should yield into the body
<?php } ?>
@b1nary
b1nary / favicon_finder.rb
Created Jul 15, 2017
Basic but well working way to find favicons by domain in Ruby
View favicon_finder.rb
class FaviconFinder
require 'open-uri'
attr_accessor :favicon_url
def initialize domain = "example.com"
@favicon_url = nil
["/favicon.ico", "/favicon.png"].each do |file|
url = "http://#{domain}#{file}"
uri = URI(url)
View foobar_controller.rb
class FooBarController < ApplicationController
before_action :set_stuff
def create
# same as below
@bar.foods.add(@foo)
end
def destroy
# remove beeing a method on the foo object here
@b1nary
b1nary / _sidebar.html.erb
Last active Jan 19, 2017
ForwardMX.io Blog Post about creating a Blog in Rails
View _sidebar.html.erb
<a href="/blog/feed.rss" class="rss" target="_blank">
<i class="fa fa-rss" aria-hidden="true"></i> RSS Feed
</a>
<h3>Categories</h3>
<div class="list-group">
<a href="<%= blogs_path %>" class="list-group-item"><strong>Show All</strong></a>
<% Blog.pluck(:category).uniq.sort.each do |cat| %>
<a href="<%= blogs_path %>?category=<%= cat %>" class="list-group-item"><%= cat %></a>
<% end %>
View slack_test.js
// I think it semi embeds gists
// Does it?
@b1nary
b1nary / _.md
Last active May 22, 2018
Tumblr Repost & Reddit post bots
View _.md

Tumblr Repost & Reddit post bots

I've created these inspired by https://www.reddit.com/r/tumblrmoney/ before i realized its not worth it for me :) Maybe some of you can user it, the code is messy and could be optimized, its also not very beautiful and done in a hurry.

But the bot worked perfectly for the last month or so, so i figured why not post it when i dont use it anyway?

Installing & Using

It needs Ruby, this is super easy if you are not using Windows.

@b1nary
b1nary / README.md
Created Oct 5, 2016 — forked from agnoster/README.md
My ZSH Theme
View README.md

agnoster.zsh-theme

A ZSH theme optimized for people who use:

  • Solarized
  • Git
  • Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)

For Mac users, I highly recommend iTerm 2 + Solarized Dark

View bash.sh
curl --data "text=Hi there&key=<%= current_api_key %>&media[]=https://example.com/image1.jpg&media[]=https://example.com/image2.jpg" https://tweee.co/api/tweet
View form.html
<%= form_tag "https://#{Rails.env.development? ? "url.com" : "other.ch"}/@@search", method: :get, id: "quick-search", role: "search" do %>
<div class="input-group">
<input type="hidden" name="facet" value="true">
<input type="hidden" name="fq" value='site_area:"Kantonsratsgeschäfte"'>
<input type="hidden" name="facet.field" value="object_type">
<input type="hidden" name="facet.field" value="topics">
<%= text_field_tag :SearchableText, "", placeholder: t("navigation.search.placeholder"), class: "form-control" %>
<span class="input-group-btn">
<button class="btn btn-secondary" id="search_submit" type="submit">
<span class="glyphicon glyphicon-search"></span>
You can’t perform that action at this time.