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
$res = $c->post( | |
'http://api.example.com/create', json_encode(array('name' => 'foobar')) | |
); |
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
./configure --prefix=/usr/local/php5.2.17 \ | |
--with-config-file-path=/etc/php5.2.17 \ | |
--with-config-file-scan-dir=/etc/php5.2.17/php.d \ | |
--enable-fastcgi \ | |
--enable-discard-path \ | |
--enable-force-cgi-redirect \ | |
--with-layout=PHP \ | |
--with-pear \ | |
--enable-calendar \ | |
--enable-bcmath \ |
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
module ActiveRecord | |
module ConnectionAdapters | |
class MysqlAdapter < AbstractAdapter | |
def create_table(table_name, options = {}) #:nodoc: | |
super(table_name, options.reverse_merge(:options => "ENGINE=NDB")) | |
end | |
end | |
end | |
end |
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 'formula' | |
def mysql_installed? | |
`which mysql_config`.length > 0 | |
end | |
class Php5.2.17 < Formula | |
url 'http://ca2.php.net/distributions/php-5.2.17.tar.gz' | |
homepage '' | |
md5 '04d321d5aeb9d3a051233dbd24220ef1' |
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
Exception while simulating the effect of invoking '/documents/update' | |
Error | |
Error: can't append to array using string field name [$] | |
at Error (<anonymous>) | |
at Function.LocalCollection._findModTarget (http://localhost:3000/packages/minimongo/modify.js?e7f02f0df0bff9f0b97236f9548637b7ede1ac74:90:15) | |
at Function.LocalCollection._modify (http://localhost:3000/packages/minimongo/modify.js?e7f02f0df0bff9f0b97236f9548637b7ede1ac74:50:38) | |
at LocalCollection._modifyAndNotify (http://localhost:3000/packages/minimongo/minimongo.js?d21efb753206850b6ada27b1fc327307eb2f2b9c:428:19) | |
at LocalCollection.update (http://localhost:3000/packages/minimongo/minimongo.js?d21efb753206850b6ada27b1fc327307eb2f2b9c:394:12) | |
at m.(anonymous function) (http://localhost:3000/packages/mongo-livedata/collection.js?2240f86c7b1195971d25f481e4a6c31da43bc0c1:378:36) | |
at http://localhost:3000/packages/livedata/livedata_connection.js?ff27a501d94ef196d150a04e346edbcbdcccdb1a:537:25 |
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 | |
# | |
# WSREP_CLUSTER_SIZE Plugin | |
# | |
# $ ./wsrep_cluster_size.rb -w 50 -c 75 | |
# | |
require 'rubygems' | |
require 'mysql2' |
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
punctuation = %w{; = - _ . , ? ! $} | |
letters = [('a'..'z'), ('A'..'Z')].map { |i| i.to_a }.flatten | |
"#{punctuation.sample}#{(0...10).map { letters[rand(letters.length)] }.join}#{rand(1000)}" |
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
# just in case you work in a server were you do not have package groups defined. RHEL / CentOS | |
# yum groupinstall 'Development Tools' | |
yum -y install autoconf automake binutils bison flex gcc gcc-c++ gettext libtool make patch pkgconfig redhat-rpm-config rpm-build rpm-sign |
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
def combinations(array) | |
m = array.length | |
(1...2**m).map do | n | | |
(0...m).select { | i | n[i] == 1 }.map { | i | array[i] } | |
end | |
end | |
def calculate_combinations(comb_array, target_sum=15) | |
combinations(comb_array).map {|a| [a, a.inject(:+)]}.select {|v| v if v.last == target_sum} | |
end |
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
a = 95800 | |
b = 217519 | |
c = 414560 | |
d = 422481 | |
a**4 + b**4 + c**4 == d**4 # => true |