Skip to content

Instantly share code, notes, and snippets.

View sicktastic's full-sized avatar
:octocat:
I may be slow to respond.

Anthony Lee sicktastic

:octocat:
I may be slow to respond.
View GitHub Profile
@sicktastic
sicktastic / countries
Created February 5, 2018 07:06 — forked from kalinchernev/countries
Plain text list of countries
Afghanistan
Albania
Algeria
Andorra
Angola
Antigua & Deps
Argentina
Armenia
Australia
Austria
@sicktastic
sicktastic / schema.rb
Last active February 3, 2018 21:01
Clean, Organized, Mirror
create_table "students", id: :serial, force: :cascade do |t|
t.string "birth_year", limit: 255, null: false
t.string "country", limit: 255, null: false
t.string "first_name", limit: 255, null: false
t.string "last_name", limit: 255, null: false
t.string "student_status", limit: 255
t.text "story", null: false
t.integer "organization_id"
t.index ["organization_id"], name: "index_students_on_organization_id"
end
@sicktastic
sicktastic / insert_cursor.vim
Created November 3, 2017 17:13
Terminal vim to have insert cursor
" set the cursor to a vertical line in insert mode and a solid block
" " in command mode
if exists('$TMUX')
let &t_SI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=1\x7\<Esc>\\"
let &t_EI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=0\x7\<Esc>\\"
else
let &t_SI = "\<Esc>]50;CursorShape=1\x7"
let &t_EI = "\<Esc>]50;CursorShape=0\x7"
endif
@sicktastic
sicktastic / HOWTO.md
Created February 26, 2017 13:44 — forked from cvan/HOWTO.md
How to serve a custom HTTPS domain on GitHub Pages with CloudFlare: *FREE*, secure and performant by default

Instructions

CloudFlare is an awesome reverse cache proxy and CDN that provides DNS, free HTTPS (TLS) support, best-in-class performance settings (gzip, SDCH, HTTP/2, sane Cache-Control and E-Tag headers, etc.), minification, etc.

  1. Make sure you have registered a domain name.
  2. Sign up for CloudFlare and create an account for your domain.
  3. In your domain registrar's admin panel, point the nameservers to CloudFlare's (refer to this awesome list of links for instructions for various registrars).
  4. From the CloudFlare settings for that domain, enable HTTPS/SSL and set up a Page Rule to force HTTPS redirects. (If you want to get fancy, you can also enable automatic minification for text-based assets [HTML/CSS/JS/SVG/etc.], which is a pretty cool feature if you don't want already have a build step for minification.)
  5. If you
@sicktastic
sicktastic / doc.md
Created February 16, 2017 20:01 — forked from oelmekki/doc.md
Rails + Browserify + React + es7

1. Gemfile

gem 'browserify-rails', '1.5.0' # until fix: https://github.com/browserify-rails/browserify-rails/issues/101
gem 'react-rails'

Browserify-rails allows to use browserify within assets pipeline. React-rails is here only to allow to use #react_component (and thus, prerendering).

Note that jquery-rails can be removed from Gemfile, the npm version of jquery and jquery-ujs will be used instead.

// Replace this:
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
// with this jQuery CDN:
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
// or the full path:
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
### Keybase proof
I hereby claim:
* I am antwonlee on github.
* I am anthonylee (https://keybase.io/anthonylee) on keybase.
* I have a public key whose fingerprint is D330 93CF C9F3 530E A6AC 4932 7C74 4637 D05D 00B0
To claim this, I am signing this object:

Pry Cheat Sheet

Command Line

  • pry -r ./config/app_init_file.rb - load your app into a pry session (look at the file loaded by config.ru)
  • pry -r ./config/environment.rb - load your rails into a pry session

Debugger

import math
-x*math.log(x, 2) - y*math.log(y, 2)

decision trees: cross-validation

This script provides an example of using cross-validation to fine-tune parameters for learning a decision tree with scikit-learn.

A blog post about this code is available here, check it out!

Requirements