Skip to content

Instantly share code, notes, and snippets.

@phocke
phocke / OSX-setup-guidlines.md
Last active December 11, 2015 05:58
setting up mac

How to get the most out of your mac

This guide has been created for regular office folks - if you're a developer go look elsewhere - you probably don't need this info. Feel free to contribute to this guide though

  • THIS IS IMPORTANT - Setup Time machine
  • THIS IS IMPORTANT - https://preyproject.com/ in case your computer gets stolen you can locate it, block it, track it, and see through the camera, using their web app. Install their app immediately. Protip: it's available for iphone, androids, ipads and regular PC's as well
  • THIS IS IMPORTANT - Encryption for hard drive
  • Setup your google accounts
  • Self control app - do you have problems staying focused because of tweeter / facebook / email ?
@phocke
phocke / gist:4594354
Created January 22, 2013 12:40
sample
just some sample gist created from ST2
@phocke
phocke / turbo-sprockets-rails3.md
Created January 27, 2013 16:03
testing turbo sprockets

with turbo-sprockets-rails3

time bundle exec rake assets:precompile --trace
=> 44.11s user 7.97s system 97% cpu 53.467 total

without turbo-sprockets-rails3

time bundle exec rake assets:precompile --trace
=> 120.72s user 9.18s system 97% cpu 2:13.42 total
@phocke
phocke / gist:4681049
Created January 31, 2013 07:34
remove image carrierwave
user = User.find_by_email "phocke@gmail.com"
user.remove_image = true
user.save
@phocke
phocke / refactoring.rb
Created February 4, 2013 09:08
refactoring old code
#Before
def redirect_blocked_browsers
if params['controller'] == 'page' && params['action'] == 'browser'
return true
end
user_agent = UserAgent.parse(request.env['HTTP_USER_AGENT'])
# Cater to CriOS until we find a better solution

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google
{
"always_show_minimap_viewport": false,
"auto_complete_commit_on_tab": false,
"bold_folder_labels": true,
"close_windows_when_empty": true,
"color_scheme": "Packages/Color Scheme - Default/Cobalt.tmTheme",
"copy_with_empty_selection": false,
"default_line_ending": "unix",
"detect_indentation": false,
"detect_slow_plugins": true,
{
"auto_upgrade_last_run": null,
"installed_packages":
[
"AdvancedNewFile",
"All Autocomplete",
"Better RSpec",
"Bracketeer",
"BufferScroll",
"CTags",
v2_reports = @crawl.v2_reports
.select { |r| !r.reported_at.nil? }
.sort_by { |r| r.reported_at.to_i }
.reverse
.uniq { |r| r.v2_report_template_id}
v2_reports = @crawl.v2_reports_dataset
.order("reported_at DESC")
.exclude(reported_at: nil)
.group(:v2_report_template_id).to_a
## Ruby
@crawl.v2_reports.select { |r| !r.reported_at.nil? }
sort_by { |r| r.reported_at.to_i }.
reverse.
uniq { |r| r.v2_report_template_id }
## Sql
[Stack overflow answer](http://stackoverflow.com/a/7250594)
SELECT t.*