Skip to content

Instantly share code, notes, and snippets.

View tonini's full-sized avatar
💭
I may be slow to respond.

Samuel Tonini tonini

💭
I may be slow to respond.
View GitHub Profile

Chess - Piece Activity Resources

Activity of our pieces is a primary goal in chess, but newer players commit lots of mistakes around this theme. By GM Irina Krush

In this live stream video, I explain the concept of "active" and "passive" pieces. Under what circumstances a piece becomes passive, how to identify a passive piece, how to improve the position of passive pieces are explained with examples in this video. By GM RB Ramesh

@btfak
btfak / useHexo.md
Created May 26, 2016 09:41
How to use Hexo and deploy to GitHub Pages

Trivial Example: Compose a meet & greet in Ruby

class Greeter
  class << self
    def meet(person, &block)
      yield person
    end

 # Greet everyone except Johnny
@rrrene
rrrene / buttons.css
Created June 23, 2015 12:04
Button style suggestion for Alchemist project page
a.button {
color: #FFFFFF;
/* font: bold 12px Helvetica, Arial, sans-serif; */
text-decoration: none;
padding: 7px 12px;
position: relative;
display: inline-block;
/* text-shadow: 0 1px 0 #fff; */
-webkit-transition: border-color .218s;
-moz-transition: border .218s;
;; In case you have no `M-,` key defined inside your Erlang-Mode
;; you want to at least have defined `M-,` to jump back to the
;; last position you came from in your Elixir code.
(defun custom-erlang-mode-hook ()
(define-key erlang-mode-map (kbd "M-,") 'alchemist-goto-jump-back))
(add-hook 'erlang-mode-hook 'custom-erlang-mode-hook)

A small sampling of external projects initially built for Ember use but designed to be used standalone:

@kevinrenskers
kevinrenskers / progress-button.less
Last active January 20, 2017 11:11
Progress button for AngularJS
/* General styles for all types of buttons */
.progress-button {
position: relative;
display: inline-block;
}
.progress-button .progress-button-content {
position: relative;
display: block;
}
@traviskaufman
traviskaufman / jasmine-this-vars.md
Last active September 19, 2022 14:35
Better Jasmine Tests With `this`

Better Jasmine Tests With this

On the Refinery29 Mobile Web Team, codenamed "Bicycle", all of our unit tests are written using Jasmine, an awesome BDD library written by Pivotal Labs. We recently switched how we set up data for tests from declaring and assigning to closures, to assigning properties to each test case's this object, and we've seen some awesome benefits from doing such.

The old way

Up until recently, a typical unit test for us looked something like this:

describe('views.Card', function() {
@jonleighton
jonleighton / gist:7122210
Created October 23, 2013 16:48
Report Rails deprecation warnings to Honeybadger (useful in production if there might be lines of code not covered by your tests - the horror!). Place this in your config/environments/production.rb
ActiveSupport::Notifications.subscribe('deprecation.rails') do |name, start, finish, id, payload|
Honeybadger.notify(
error_class: "DEPRECATION WARNING",
error_message: payload[:message],
backtrace: payload[:callstack]
)
end
include Math;R1=1.0; R2=2.0;K2=5.0
SS=40;K1=SS*K2*3/(8*(R1+R2));def rf(a, b)
cosA=cos(a);sinA=sin(a);cosB=cos(b);sinB=sin(b)
o=Array.new(SS).fill{Array.new(SS).fill(' ')};b=Array.
new(SS).fill{ Array.new(SS).fill(0)}; t=0.0;while t<2*PI
cost=cos(t);sint=sin(t);p=0.0;while p<2*PI;cosp=cos(p);sinp=
sin(p);cx=R2+R1*cost;cy=R1* sint;x=cx*(cosB*cosp+sinA*
sinB*sinp)-cy*cosA*sinB; y=cx*(sinB*cosp-sinA*##
cosB*sinp)+cy*cosA*cosB ;z=K2+cosA*cx*sinp+cy*
sinA;ooz=1/z;xp=(SS/2+K1* ooz*x).to_i ;yp= (SS/2-