Skip to content

Instantly share code, notes, and snippets.

View NARKOZ's full-sized avatar

Nihad Abbasov NARKOZ

  • Kyiv, Ukraine
View GitHub Profile
@SaitoWu
SaitoWu / graph.rb
Last active December 25, 2017 07:30
Github Contribution Graph
require 'date'
author = "Saito"
email = "saitowu@gmail.com"
date = Date.new(2012, 7, 30)
s = %w{
. . . . . . .
. . o o o . .
. o . . . . .
@ganta
ganta / gist:5360630
Created April 11, 2013 03:58
GitHubのcommitのURLの末尾に ?w=1 とつけると差分がわかりやすい(時がある) http://d.hatena.ne.jp/ken_c_lo/20130410/1365623063 を見てやっつけで作ったBookmarkletです。付いてなければ付けるだけです。もっと簡潔な書き方があれば教えてください。
javascript:
var url = location.href;
if (url.match(/^https:\/\/github\.com\/.*\/commit\//)) {
var params = url.split('?')[1];
if (params == undefined) {
location.href = url + '?w=1'
}
}
@ryansobol
ryansobol / gist:5252653
Last active November 22, 2023 11:53
15 Questions to Ask During a Ruby Interview

Originally published in June 2008

When hiring Ruby on Rails programmers, knowing the right questions to ask during an interview was a real challenge for me at first. In 30 minutes or less, it's difficult to get a solid read on a candidate's skill set without looking at code they've previously written. And in the corporate/enterprise world, I often don't have access to their previous work.

To ensure we hired competent ruby developers at my last job, I created a list of 15 ruby questions -- a ruby measuring stick if you will -- to select the cream of the crop that walked through our doors.

What to expect

Candidates will typically give you a range of responses based on their experience and personality. So it's up to you to decide the correctness of their answer.

@tlowrimore
tlowrimore / union_scope.rb
Last active January 13, 2023 21:12
Unions multiple scopes on a model, and returns an instance of ActiveRecord::Relation.
module ActiveRecord::UnionScope
def self.included(base)
base.send :extend, ClassMethods
end
module ClassMethods
def union_scope(*scopes)
id_column = "#{table_name}.#{primary_key}"
sub_query = scopes.map { |s| s.select(id_column).to_sql }.join(" UNION ")
where "#{id_column} IN (#{sub_query})"
@jakeonrails
jakeonrails / Ruby Notepad Bookmarklet
Created January 29, 2013 18:08
This bookmarklet gives you a code editor in your browser with a single click.
data:text/html, <style type="text/css">#e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div id="e"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script>
@dcramer
dcramer / fix_requests.py
Last active December 11, 2015 21:28
Because you should maintain API compatibility when you tell everyone to use your shit.
from requests.models import Response
class fixedjson(object):
def __init__(self, func):
self.func = func
def __get__(self, inst, cls):
result = self.func(inst)
class proxy(type(result)):
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active May 17, 2024 02:53
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@magnetikonline
magnetikonline / README.md
Last active May 22, 2020 18:55
SSH/Readline cheatsheet.

SSH/Readline cheatsheet

Under Emacs mode, typically the default for most shells.

Ctrl + B
Basic moves
Move back one character
@uasi
uasi / pixiv_bookmark_downloader.rb
Last active May 3, 2023 20:26
A utility to download bookmarked items from pixiv
#!/usr/bin/env ruby
#
# Usage:
# export PIXIV_ID=<your pixiv ID>
# export PIXIV_PASSWORD=<your pixiv password>
# pixiv_bookmark_downloader.rb [download_dir]
#
# This script downloads your bookmarked items to
# <download_dir>/<member_id>/<image_name> (e.g. downloads/123/456.jpg)
@bensie
bensie / base.rb
Created December 6, 2012 17:53
Sinatra API Helpers
require "sinatra/base"
require "sinatra/namespace"
require "multi_json"
require "api/authentication"
require "api/error_handling"
require "api/pagination"
module Api
class Base < ::Sinatra::Base