Skip to content

Instantly share code, notes, and snippets.

var cursor = db.getCollection('foo').find({}, {});
while(cursor.hasNext()) {
print(tojson(cursor.next()))
}
@toothfairy
toothfairy / howler-mute.js.coffee
Created September 16, 2014 09:01
Crossbrowser howler mute on tab live
hidden = undefined
visibilityChange = undefined
if typeof document.hidden isnt "undefined" # Opera 12.10 and Firefox 18 and later support
hidden = "hidden"
visibilityChange = "visibilitychange"
else if typeof document.mozHidden isnt "undefined"
hidden = "mozHidden"
visibilityChange = "mozvisibilitychange"
else if typeof document.msHidden isnt "undefined"
@toothfairy
toothfairy / gist:7524541
Created November 18, 2013 08:33
Allow connections through localhost Was used to fix issue with iptables due to some dork ispmanager usage
iptables -I INPUT 1 -i lo -j ACCEPT
iptables -I OUTPUT 1 -o lo -j ACCEPT
@toothfairy
toothfairy / gist:6607381
Created September 18, 2013 10:38
installing sphinx on debian
I had a proglem with index_exact_words parameter in 2.0.8
so i used an earlier version
also debian package strictly uses libmysqlclient16 but current stable is libmysqlclient18
wget http://sphinxsearch.com/files/sphinx-2.0.7-release.tar.gz
tar xvfz sphinx-2.0.7-release.tar.gz
cd sphinx-2.0.7-release && ./configure --without-pgsql
make install
@toothfairy
toothfairy / gist:3005732
Created June 27, 2012 18:03
What to do after lion start
Dock – auto hide
Desktop -> Screen Saver -> Hot corners
Lang - English, Format - Russian, Input Sources - Russian PC
Energy Saver
iCloud - find mac
Display - auto adjust brightness
http://www.iclarified.com/entry/index.php?enid=14356
disable spotlight and hide icon
Enable apache in preferences
git aws.config
AWS Access Key: AccessKey
AWS Secret Key: SecretKey
AWS Region [default to us-east-1]:
AWS Host [default to git.elasticbeanstalk.us-east-1.amazonaws.com]:
AWS Elastic Beanstalk Application: HelloEvercode
AWS Elastic Beanstalk Environment: development
@toothfairy
toothfairy / gist:2199220
Created March 25, 2012 19:31
amazon elastic beanstalk command line interface
git add ./
git commit -m 'initial commit'
[master (root-commit) a4db9f9] initial commit
1 files changed, 3 insertions(+), 0 deletions(-)
create mode 100644 index.php
@toothfairy
toothfairy / uploader.rb
Created February 28, 2012 11:02
resize_to_fill image with sizes from model
class CoverUploader < CarrierWave::Uploader::Base
include CarrierWave::RMagick
version :some_vesion do
process :do_resize
end
def do_resize
manipulate! do |img|
sudo nano ~/.bash_profile
mkdir ~/.ec2
cd ~/Current-tool-path
mv *.pem ~/.ec2
cd ~/Current-tool-path/ec2-api-tools-version/
mv * ~/.ec2