Skip to content

Instantly share code, notes, and snippets.

Anton Rogov antonrogov

Block or report user

Report or block antonrogov

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 vk.js
// ВКонтакте killer (2012-08-13)
addKiller("ВКонтакте", {
"canKill": function(data) {
return data.src.indexOf("vkontakte.ru/swf/") !== -1 || data.src.indexOf("vk.com/swf/") !== -1;
},
"process": function(data, callback) {
var flashvars = parseFlashVariables(data.params.flashvars);
View YouTube.js
addKiller("YouTube", {
"processItag": function(itag) {
if(itag === "38") return {"format": "4K MP4", "height": 2304, "isNative": true};
if(itag === "37") return {"format": "1080p MP4", "height": 1080, "isNative": true};
if(itag === "22") return {"format": "720p MP4", "height": 720, "isNative": true};
if(itag === "18") return {"format": "360p MP4", "height": 360, "isNative": true};
if(canPlayFLV) {
if(itag === "35") return {"format": "480p FLV", "height": 480, "isNative": false};
if(itag === "5") return {"format": "240p FLV", "height": 240, "isNative": false};
View caveatPatchor.js
/*
As of version 1.1.2, Propane will load and execute the contents of
~Library/Application Support/Propane/unsupported/caveatPatchor.js
immediately following the execution of its own enhancer.js file.
You can use this mechanism to add your own customizations to Campfire
in Propane.
Below you'll find two customization examples.
View install.sh
sudo tmutil disablelocal
ssh-keygen -t rsa -b 4096 -N ""
chsh -s /bin/zsh
# install dotfiles
rehash
/usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)"
# echo 'export PATH="/usr/local/sbin:/usr/local/bin:$PATH"' >> .zshrc
rehash
fetch https://github.com/downloads/kennethreitz/osx-gcc-installer/GCC-10.7-v2.pkg
# fetch https://github.com/downloads/kennethreitz/osx-gcc-installer/GCC-10.6.pkg
@antonrogov
antonrogov / gist:1216380
Created Sep 14, 2011
JavaScript Coding Guidelines
View gist:1216380

JavaScript Coding Guidelines

This is a set of coding conventions and rules for use in JavaScript programming. It is inspired by the Sun document Code Conventions for the Java Programming Language. It is heavily modified of course because JavaScript is not Java.

The long-term value of software to an organization is in direct proportion to the quality of the codebase. Over its lifetime, a program will be handled by many pairs of hands and eyes. If a program is able to clearly communicate its structure and characteristics, it is less likely that it will break when modified in the never-too-distant future.

Code conventions can help in reducing the brittleness of programs.

All of our JavaScript code is sent directly to the public. It should always be of publication quality.

@antonrogov
antonrogov / gist:1216347
Created Sep 14, 2011
Ruby Coding Guidelines
View gist:1216347

Ruby Coding Guidelines

Formatting

  • Use UTF-8 as the source file encoding.
  • Use 2 space indent, no tabs. (Your editor/IDE should have a setting to help you with that)
  • Use Unix-style line endings. (Linux/OSX users are covered by default, Windows users have to be extra careful)
    • if you're using Git you might want to do this $ git config --global core.autocrlf true to protect your project from Windows line endings creeping into your project
  • Use spaces around operators, after commas, colons and semicolons, before { and }.
View git-review
#!/usr/bin/env ruby
def find_branches(name)
`git branch -r|grep '/#{name.gsub("'", '')}'`.to_s.split("\n").map(&:strip)
end
def last_commit_url(branch)
remote, name = branch.split('/')
sha = `git log -n 1 #{branch}|head -n 1|awk '{print $2}'`.strip
url = `git remote -v|grep #{remote}|grep '(push)'|awk '{print $2}'`.strip
@antonrogov
antonrogov / nil_true.rb
Created Jan 10, 2011
nil is true in ?:
View nil_true.rb
class Proxy
instance_methods.each do |method|
undef_method(method) unless method =~ /(^__|^send$|^object_id$|^extend$)/
end
def initialize(target)
@target = target
end
def method_missing(name, *args, &block)
View gist:716426
" An example for a vimrc file.
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last change: 2002 Sep 19
"
" To use it, copy it to
" for Unix and OS/2: ~/.vimrc
" for Amiga: s:.vimrc
" for MS-DOS and Win32: $VIM\_vimrc
" for OpenVMS: sys$login:.vimrc
View gist:447019
# to create a new student
s1 = Sevis::Student.new(
:personal_info => {
:birth_date => '1986/12/01',
#...
},
:educational_info => {
:edu_level => {
:level => '...'
#...
You can’t perform that action at this time.