Skip to content

Instantly share code, notes, and snippets.

@rfunduk
rfunduk / osx.sh
Last active August 27, 2021 15:00 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with useful tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2263406/osx.sh | sh
#
{
"Version": "2008-10-17",
"Statement": [
{
"Sid": "PublicReadForGetBucketObjects",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "s3:GetObject",
@rfunduk
rfunduk / example_controller.rb
Created February 17, 2012 13:24 — forked from shime/example_controller.rb
sending errors to Exceptional with rescue_from
class ExampleController < ApplicationController
rescue_from Exception, :with => :render_custom
def render_custom(exception)
if Exceptional::Remote.error(Exceptional::ExceptionData.new(exception, "Test Exception"))
Rails.logger.info "Exceptional: #{exception.class} has been reported to Exceptional"
else
Rails.logger.error "Exceptional: Problem sending exception. Check your API key."
end
it "should etc, etc" do
using_constants( SomeClass, { :CONST_A => stub, :CONST_B => 1 } ) do
# ...
end
end
ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/'
namespace :admin do
mount Resque::Server, :at => '/resque'
# ...
end
InjectedScript._type = function(obj)
{
// ... some code ...
// ... some conditions ...
// Add our own:
if (obj.__proto__ && obj.__proto__.jquery)
return "array";
// ... leave the fall back ...
#!(path-to-python, eg. /usr/bin/python)
import sqlite3
db = sqlite3.connect( "stats.sqlite3" )
db.cursor().execute( "CREATE TABLE IF NOT EXISTS " \
"visits ( page TEXT, timestamp TEXT, ip TEXT )" )
<div id="footer"></div>
<a href="somewhere.com" rel="external" title="somewhere.com">
somewhere.com
</a>