This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# | |
# Mass assignment scanner for Ruby on Rails | |
# should be run from rails console in production | |
# environment. | |
#make sure all models are loaded | |
Dir[Rails.root + 'app/models/**/*.rb'].each { |path| require path } | |
models = ActiveRecord::Base.subclasses |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I am trying out Ratchet.io and I want to add their deployment notification to my | |
# normal capistrano deployment process. Here is my first working attempt. | |
# Add this task to your deploy.rb | |
task :notify_ratchetio, :roles => :app do | |
set :revision, `git log -n 1 --pretty=format:"%H"` | |
set :local_user, `whoami` | |
set :ratchetio_token, YOUR_ACCESS_TOKEN | |
rails_env = fetch(:rails_env, "production") | |
run "curl https://submit.ratchet.io/api/1/deploy/ -F access_token=#{ratchetio_token} -F environment=#{rails_env} -F revision=#{revision} -F local_username=#{local_user} >/dev/null 2>&1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
build_package_combined_patch() { | |
local package_name="$1" | |
{ | |
curl https://raw.github.com/gist/4136373/falcon.diff | patch -p1 | |
autoconf | |
./configure --prefix="$PREFIX_PATH" $CONFIGURE_OPTS | |
make -j 8 | |
make install | |
} >&4 2>&1 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/bin/console.sh b/bin/console.sh | |
index 1932011..5edbeae 100644 | |
--- a/bin/console.sh | |
+++ b/bin/console.sh | |
@@ -3,24 +3,10 @@ | |
# Copyright (c) 1999-2010 Luca Garulli | |
# | |
-# resolve links - $0 may be a softlink | |
-PRG="$0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% rspec spec/integration/application/doc_spec.rb spec/integration/util/rdoc spec/unit/application/doc_spec.rb spec/unit/util/rdoc* | |
/Users/kavu/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': iconv will be deprecated in the future, use String#encode instead. | |
/Users/kavu/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- rdoc/tokenstream (LoadError) | |
from /Users/kavu/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require' | |
from /Users/kavu/Work/GitHub/puppet/lib/puppet/util/rdoc/parser.rb:9:in `<top (required)>' | |
from /Users/kavu/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require' | |
from /Users/kavu/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require' | |
from /Users/kavu/Work/GitHub/puppet/spec/integration/util/rdoc/parser_spec.rb:5:in `<top (required)>' | |
from /Users/kavu/.rvm/gems |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE FlexibleInstances, TypeSynonymInstances, IncoherentInstances #-} | |
class (MyClass t) where | |
doShow :: (Show t) => t -> String | |
instance (MyClass String) where | |
doShow x = "Your string is " ++ x | |
instance (MyClass t) where | |
doShow x = "Your parameter is " ++ show x | |
instance (MyClass [t]) where | |
doShow x = do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rest_client' | |
require 'json' | |
a = `sox -d --norm -t .flac - silence -l 1 0 1% 1 6.0 1% rate 16k` | |
#a = `arecord -q -d 3 -c 1 -f S16_LE -r 22050 -t wav | flac - -f --totally-silent -o-` | |
r = RestClient.post 'https://www.google.com/speech-api/v1/recognize?lang=en-US', a, | |
:content_type => 'audio/x-flac; rate=16000' | |
(p j; `espeak 'you said: #{j['hypotheses'].first['utterance']}'`) if (j = JSON.parse(r)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ПоПацански.cpp : Defines the entry point for the console application. | |
// | |
// #include "stdafx.h" | |
#define подъёбку setlocale | |
#define чуть_чуть 7 | |
#define так_себе 12 | |
#define пошло_оно_всё 120 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/http' | |
require 'json' | |
class Net::HTTP::Patch < Net::HTTPRequest | |
METHOD = 'PATCH' | |
REQUEST_HAS_BODY = true | |
RESPONSE_HAS_BODY = true | |
end | |
url = URI.parse('https://api.github.com/user') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Original code: | |
https://github.com/brandon/lucid/blob/master/spec/javascripts/z_jshint_spec.js | |
*/ | |
describe('JSHint', function () { | |
var options = {curly: true, white: true, indent: 2}, | |
files = /^\/src|.*spec\.js$/; | |
function get(path) { |