Skip to content

Instantly share code, notes, and snippets.

sub censor
{
my ($msg, $stopwords_regex) = @_;
my $letters = { map { $_ => 1 } ( 'a' .. 'z', 'A' .. 'Z', '0' .. '9', '@' ) };
$msg =~ s/ / /og;
my $i = 0;
my $numerated_letters = [ grep { $letters->{$_->[1]} } map { [ $i++ , $_ ] } split //, $msg_cp ];
my $deobfuscated_msg = join( '', map { $_->[1] } @$numerated_letters );
@gumayunov
gumayunov / tpl-basicapp.rb
Created August 5, 2011 03:50 — forked from davidrichards/tpl-basicapp.rb
Rails 3, RSpec, Factory_Girl, HAML, SASS, Devise, JQuery, Backbone.js, jammit
## Rails App Template
## Updated for Rails 3.0.7
## Created on 10/23/10
## Updated on 5/25/11 to simplify for my own use
## Run using $ rails new [appname] -JT -m tpl-basicapp.rb
## Gems
# Warden and Devise for security
gem 'warden', '1.0.4'
%% show comment
handle(HD, {get, {comments, CommentId}}, Req) when is_integer(CommentId) ->
Result = case select_comment(person, CommentId) of
not_found ->
error_404;
Comment ->
UserId = proplists:get_value(user_id, Comment),
[Uinfo|_] = select_uinfoes_by_ids(person, [UserId]),
{ok, {[
{comment, {Comment} },
module SocialConnect
module Providers
class Vkontakte < Base
config_readers :app_id, :app_secret
config_readers :group_id
js_config :app_id, :group_id
cookie_key do
"vk_app_#{app_id}"
@gumayunov
gumayunov / gist:889080
Created March 27, 2011 09:33
split-cue-flac
#!/bin/sh
# Dependencies:
# sudo apt-get install cuetools shntool
SAVEIFS=$IFS
IFS='\n'
find ./ -name '*.flac' -size +100M | while read image
do
echo "$image"
@gumayunov
gumayunov / gist:865526
Created March 11, 2011 06:08
oEmbed test
тест oEmbed http://www.oembed.com/
Напишите мне, пожалуйста, если видите это в своем клиенте.
#!/bin/sh
REF=`git symbolic-ref HEAD | sed -e 's/refs\/heads\///'`
REMOTE=`git config --get branch.$REF.remote`
git fetch $REMOTE
git push -f $REMOTE $REF
// {{{ Twitter
this.Twitter = function(opts) { this.init(opts); };
this.Twitter.prototype = {
init: function(opts) {
var self = this;
self.opts = opts;
if (!self.opts.container) self.opts.container = default_container();
screen pair programming
User john (driver):
echo "multiuser on" >> ~/.screenrc
sudo chmod u+s /usr/bin/screen
sudo chmod 755 /var/run/screen
screen -S pairprog
var A = function(){
console.debug("A constructor");
A.build();
};
(function(){
var p = 0;
this.B = function(){
console.debug('B constructor');
};