Skip to content

Instantly share code, notes, and snippets.

View Jacke's full-sized avatar
👀
Mastermind

Stan Sobolev Jacke

👀
Mastermind
View GitHub Profile
@Jacke
Jacke / dabblet.css
Created September 19, 2012 06:33 — forked from anonymous/dabblet.css
Untitled
button {
position:relative;
display:block;
margin:50px;
padding:0;
width:250px;
height:50px;
border:none;
border-radius:50px;
@Jacke
Jacke / Shake_form.js
Created January 16, 2013 10:00
Shake object with tag form w/o jquery
addLoadEvent = function (func) {
if (typeof jQuery != "undefined") jQuery(document).ready(func);
else if (typeof wpOnload != 'function') {
wpOnload = func;
} else {
var oldonload = wpOnload;
wpOnload = function () {
oldonload();
func();
}
@Jacke
Jacke / blockquote.css
Created January 19, 2013 18:00
Blockquote styling
.postdetail article q,.postdetail article blockquote {
position:relative;
color:#666;
display:block;
font-family:"Adobe Garamond","Garamond",times,"times new roman",serif;
font-style:italic;
font-size:36px;
line-height:42px;
margin:15px 0;
}
@Jacke
Jacke / .irbrc
Last active December 14, 2015 04:29
Ascii rails app name
# gem install macaddr | into Gemfile if you want
==begin
require 'macaddr'
==end
require 'socket'
gateway = `ip route show`.match(/default.*/)[0].match(/\d\d?\d?\.\d\d?\d?\.\d\d$
def local_ip
orig, Socket.do_not_reverse_lookup = Socket.do_not_reverse_lookup, true # turn off reverse DNS resolution temporarily
UDPSocket.open do |s|
@Jacke
Jacke / README.md
Created February 26, 2013 22:46 — forked from chrismytton/README.md

Literate Ruby

Inspired by Literate CoffeeScript.

$ cat hello.litrb
Here's a simple program

    puts "Hello, world"
$ ruby litrb.rb < hello.litrb

Hello, world

@Jacke
Jacke / .railsrc
Created March 3, 2013 11:40 — forked from janlelis/.railsrc
# .railsrc for Rails 3, encoding: utf-8
# see http://rbjl.net/49-railsrc-rails-console-snippets
if !Rails.application then warn "Rails isn't loaded, yet... skipping .railsrc" else
# # #
def ripl?; defined?(Ripl) && Ripl.instance_variable_get(:@shell); end
# # #
# loggers

Literate Ruby

Inspired by Literate CoffeeScript.

$ cat hello.litrb
Here's a simple program

    puts "Hello, world"
$ ruby litrb.rb < hello.litrb

Hello, world

-module(head_srv).
-compile(export_all).
%-export([start/1, benchmark/1, console_start/0, loop/1]).
-include("jsonerl/jsonerl.hrl").
-record(command, {action, error, login, desc}).
-record(logic_state, {ies = none}).
-define(INTERNAL_TIMEOUT, 10000).
-define(LISTEN_PORT, 6070).
@Jacke
Jacke / rewrite_hash.rb
Created March 13, 2013 11:26
If in old hash exist record, then in new nil value can be accepted, otherwise if not nil it would be rejected
hash_old = {"a"=>100, "b"=>""}
Hash["a", "", "", ""].reject { |k,v| v.blank? if hash_old[k].blank? }
# => {"a"=>""}
class Game
attr_reader :name, :tags
def initialize(name)
@name = name
@tags = []
end
def year(value)
@year = value