This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package sample | |
import scala.language.implicitConversions | |
import shapeless._ | |
import shapeless.Everywhere | |
import ops.hlist.{Align, Mapper, Prepend} | |
import poly._ | |
import record._ | |
import syntax.singleton._ | |
import shapeless.tag |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
execute pathogen#infect() | |
syntax on | |
set shiftwidth=2 | |
set tabstop=2 | |
set expandtab | |
set autoindent | |
set tags=~/tags | |
set backspace=2 | |
let &colorcolumn=join(range(81,999),",") | |
highlight ColorColumn ctermbg=255 guibg=#b5baa9 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Currying a proc causes #arity to return -1 | |
# | |
# This adds a #real_arity method to a Proc that always reflects the | |
# number of *remaining* parameters to be accepted (minus any partially applied) | |
class Proc | |
@r_arity = nil | |
def real_arity | |
@r_arity || arity | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import akka.actor.ActorSystem | |
import akka.stream.{ActorMaterializer, ActorAttributes} | |
import akka.stream.scaladsl._ | |
import scala.concurrent.Future | |
import scala.concurrent.ExecutionContext.Implicits.global | |
object StreamProgram { | |
implicit lazy val system = ActorSystem("example") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# An exercise in controlled side effects inspired by | |
# http://tmd.io/code/2015/01/27/putting-away-your-laundry-a-look-at-service-objects-for-rails.html | |
# Generic "immutable" wrapper for hash of values and hash of validators | |
# Only unvalidated or Valid values come out of #to_h | |
# Validators can return ValidatedParams::Error('message') to come out of #errors | |
# This is a great candidate for property based testing and has no dependencies beyond hashes and procs | |
class ValidatedParams | |
Valid = true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RCipher | |
def take(s, n, stream) | |
x = 0 | |
val = s | |
acc = [] | |
while x < n do | |
val = stream.call(val) | |
acc.push(val) | |
x += 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
update wp_term_taxonomy as tt | |
left join (select term_taxonomy_id as tid, count(term_taxonomy_id) as real_count | |
from wp_term_relationships as tr | |
left join wp_posts as p on tr.object_id = p.ID | |
where p.post_status = "publish" | |
group by tid) | |
as rc | |
on rc.tid = tt.term_taxonomy_id | |
set tt.count = rc.real_count |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(app_name_domain_controller, [Req]). | |
-compile(export_all). | |
all('GET', [Type]) -> | |
% TODO: expand flexibility of filtering interface | |
{json, boss_db:find(list_to_atom(Type), lists:map(fun({K, V}) -> {list_to_atom(K), 'equals', V} end, | |
Req:query_params()), [{order_by, last_update}, {order, desc}])}. | |
show('GET', [Id]) -> | |
Model = boss_db:find(Id), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Player extends Post | |
{ | |
private $_points = false; | |
public static $after_save = array('update_points'); | |
public function set_points($points) | |
{ | |
$this->_points = $points; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Class to provide factory methods for seamless use | |
class UploadedFile extends CComponent | |
{ | |
public function init() | |
{ | |
parent::init(); | |
} |