Skip to content

Instantly share code, notes, and snippets.

moment::firstDayOfMonth = -> @date 1
moment::nextDay = (day) -> @add 1,'d' while @day() != day; @
moment::firstDay = (day) -> @firstDayOfMonth.nextDay day
moment::allDaysRemainingInMonth = ->
t = @clone()
while t.month() == m || m = t.month()
day = t.clone()
@benaubin
benaubin / word.rb
Last active February 15, 2016 22:25 — forked from lpar/pwgen.rb
Simple generation of readable random made-up words using Ruby
#!/usr/bin/env ruby
# encoding: UTF-8
# Simple word gen in Ruby.
#
# Example:
#
# gen
# gen 10
# gen 7, "prefix-"
@benaubin
benaubin / codesample.js
Last active March 28, 2016 02:10
A nice way of making javascript in `<code>` blocks editable.
function addScript(src,callback){
var s = document.createElement('script');
s.setAttribute('src', src);
s.onload = callback;
document.body.appendChild(s);
}
function addStyles(){
var s = document.createElement('style');
s.innerText = "\
span.result.error {\

Syntax

All target selectors start with @. The following character is the selector type. For example, @p means 'closest player'.

Target selectors may have additional, optional arguments. You can specify these in [ ], using the syntax a=0. For example, @p[a=0,b=5,c=-500].

There is a special short syntax for just specifying x, y, z and r arguments; simply list their values separated by a comma, without x=. For example: @p[100,64,-100,5] for 5 range, x=100, y=64 and z=-100. Each of these are optional and skippable by leaving them empty. For example, to just specify y coordinate: @p[,64].

Global Arguments:

(Case sensitive)

  • x - X coordinate for search center. Default is senders coordinate, or 0.
5000000 times
user system total real
With if, Symbol 1.710000 0.010000 1.720000 ( 1.717787)
With if, Array Size 2 0.730000 0.000000 0.730000 ( 0.733222)
With if, Array Size 3 0.740000 0.000000 0.740000 ( 0.737046)
With if, Array Size 4 0.740000 0.000000 0.740000 ( 0.747544)
With if, Array Size 5 0.740000 0.010000 0.750000 ( 0.746374)
Without if, Symbol 1.500000 0.000000 1.500000 ( 1.514637)
Without if, Array Size 2 0.830000 0.010000 0.840000 ( 0.834003)
Without if, Array Size 3 0.830000 0.000000 0.830000 ( 0.834955)
@benaubin
benaubin / swagger.json
Created May 12, 2015 17:59
PlanHWDocs
{
"swagger": "2.0",
"info": {
"version": "1.0.0",
"title": "PlanHW",
"description": "#### PlanHW is your new planner - And it's the planner YOU make\nPlanHW has an awesome API that lets you focus on making an awesome planner, and not reinventing the wheel. It's pretty cool, and allows you to make planners that inigrate seemlessly [online](http://planhw.com).\n",
"termsOfService": "http://planhw.com/tos",
"contact": {
"name": "Ben (from BenSites.com)",
"email": "hello@PlanHW.com",

Keybase proof

I hereby claim:

  • I am penne12 on github.
  • I am penne (https://keybase.io/penne) on keybase.
  • I have a public key whose fingerprint is F388 F64C EDFB 1A4E 5858 EBDF B659 E9A8 F31B D679

To claim this, I am signing this object: