Skip to content

Instantly share code, notes, and snippets.

View abe33's full-sized avatar

Cédric Néhémie abe33

  • Clermont-Ferrand, France
View GitHub Profile
@abe33
abe33 / collector.coffee
Created February 23, 2015 15:19
Collect markdown preview styles
rules = []
ruleRegExp = /\.markdown-preview/
for stylesheet in document.styleSheets
if stylesheet.rules?
for rule in stylesheet.rules
if rule.selectorText?.match(ruleRegExp)?
rules.push(rule.cssText)
console.log rules.join('\n')

Keybase proof

I hereby claim:

  • I am abe33 on github.
  • I am abe33 (https://keybase.io/abe33) on keybase.
  • I have a public key whose fingerprint is B5DD F04C 3132 C101 740F 2755 5BCA E0C4 DEDF 3CF0

To claim this, I am signing this object:

@abe33
abe33 / abe.itermcolors
Created December 30, 2015 15:23
Iterm setup
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.18021853268146515</real>
@abe33
abe33 / form.html.haml
Last active January 2, 2016 19:28
nested_form and strong_parameters issues with 2 nested models forms. The customs gem (https://github.com/inkstak/customs) is used to provide basic resource flow in controllers (hence the `resource_params` method)
-# Here resource is the timeline
= simple_nested_form_for resource, url: [resource] do |form|
%table.nested_form
= form.fields_for :marker_sections, wrapper: false do |section_form|
%tr.fields
%td
%table.nested_form
%thead
%tr.section
@abe33
abe33 / commands.coffee
Last active March 7, 2016 16:42
Minimap Decorations Demo Commands
atom.packages.serviceHub.consume 'minimap', '1.0.0', (minimapAPI) ->
img = new Image()
img.src = 'file:///path/to/tile.png'
routine = (decoration, data) ->
range = decoration.getMarker().getScreenRange()
rowSpan = range.end.row - (range.start.row)
pattern = data.context.createPattern(img, 'repeat')
data.context.fillStyle = pattern#
@abe33
abe33 / compute-line-offsets.cpuprofile
Created March 22, 2016 15:00
Compute Line Offsets
This file has been truncated, but you can view the full file.
{"head":{"functionName":"(root)","scriptId":"0","url":"","lineNumber":0,"columnNumber":0,"hitCount":0,"callUID":373,"children":[{"functionName":"","scriptId":"147","url":"/Users/cedric/github/atom/src/window-event-handler.coffee","lineNumber":3,"columnNumber":47,"hitCount":0,"callUID":17,"children":[{"functionName":"module.exports.WindowEventHandler.handleDocumentKeyEvent","scriptId":"147","url":"/Users/cedric/github/atom/src/window-event-handler.coffee","lineNumber":97,"columnNumber":67,"hitCount":0,"callUID":16,"children":[{"functionName":"module.exports.KeymapManager.handleKeyboardEvent","scriptId":"174","url":"/Users/cedric/github/atom/node_modules/atom-keymap/lib/keymap-manager.js","lineNumber":324,"columnNumber":59,"hitCount":1,"callUID":15,"children":[{"functionName":"module.exports.KeymapManager.dispatchCommandEvent","scriptId":"174","url":"/Users/cedric/github/atom/node_modules/atom-keymap/lib/keymap-manager.js","lineNumber":561,"columnNumber":60,"hitCount":0,"callUID":12,"children":[{"functionName":
@abe33
abe33 / events.es6
Created February 10, 2017 09:56
Pautay's gist
class Disposable {
constructor (block) {
if (!block) {
throw new Error('A Disposable must be created with a dispose callback')
}
this.block = block
}
dispose () {
if (this.block) {
const fs = require('fs');
module.exports = {
convertToJson: (filepath, options, callback) => {
callback && fs.readFile(filepath, (err, buf) => {
if (err) { callback(err) }
callback(null, String(buf).split("\n").map(line => {
const [glyph, ruby] = line.split(options.separator);
return { glyph, ruby };
}));
@abe33
abe33 / power-level.md
Last active February 22, 2018 17:01
Splatoon Power Level

Power Level and Rank Skip

Let's get this out of the way real quick: We don't really know what accounts for a player's power level. Most likely this is a combination of rank power levels (as described in https://splatoonwiki.org/wiki/Splatfest_Power) with an Elo-based score evolution (as seen in splatfest and leagues) plus another factor that I'll detail later which is more linked to the team-based nature of Splatoon.

The problem here has several faces to it. We need to explain the following elements we can observe daily:

  • How one skips ranks even with cracks when one doesn't with no losses?
  • How the gauge increases differently for apparently random reasons?
  • How one gets cracks instantly and sometimes only after 3 games?

The starting point of my reasoning comes from what we could all see when splatoon was released or, more recently, when clam blitz came out.

@abe33
abe33 / init.coffee
Last active May 1, 2018 21:44
Scrolling Atom editors without moving the cursor
atom.commands.add 'atom-text-editor',
'editor:scroll-down': ->
editor = atom.workspace.getActiveTextEditor()
editorElement = atom.views.getView(editor)
newScrollTop = editorElement.getScrollTop() + editorElement.getHeight()
editorElement.setScrollTop(newScrollTop)
'editor:scroll-up': ->
editor = atom.workspace.getActiveTextEditor()
editorElement = atom.views.getView(editor)