Skip to content

Instantly share code, notes, and snippets.

@dams
dams / gist:1212507
Created September 12, 2011 21:30
different approach
sub Mo'import {
import warnings; $^H |= 0x602;
my $p = caller."'";
@_ = ( ISA, extends, has, sub {
my ( $n, %a ) = @_;
my $d = $a{default}||$a{builder};
*{ $p . $n } = $d
? sub {
$#_ ? $_[0]{$n} = $_[1]
: exists $_[0]{$n} ? $_[0]{$n}
--- a/src/Mo.pm
+++ b/src/Mo.pm
@@ -12,8 +12,8 @@ sub Mo'import {
my $d = $a{default}||$a{builder};
*{ $p . $n } = $d
? sub {
- return $#_ ? $$_{$n} = pop
- : ! exists $$_{$n} ? $$_{$n} = $_->$d
+ return $$_{$n} = $#_ ? pop
+ : ! exists $$_{$n} ? $_->$d
~/Devel/mo-pm xs_classaccessor2 ➔ git reset --hard df263586703f53576e4e334e156d6e9e18002504
HEAD is now at df26358 class xs accessor feature
~/Devel/mo-pm xs_classaccessor2 ➔ git push origin xs_classaccessor
Everything up-to-date
~/Devel/mo-pm xs_classaccessor2 ➔ git push -f origin xs_classaccessor
Everything up-to-date
@dams
dams / gist:5876003
Last active December 19, 2015 01:29
void mapping_convert_inline_c(SV* hash_ref, SV* dict_ref) {
HV* hash;
HE* hash_entry;
int num_keys, i;
SV* sv_key;
SV* sv_val;
SV* sv_val2;
HV* dict;
is_primary_for_doc(BKey) ->
{ok, CHBin} = riak_core_ring_manager:get_chash_bin(),
DocIdx = riak_core_util:chash_key(BKey),
Itr = chashbin:iterator(DocIdx, CHBin),
MyNode = node(),
case chashbin:itr_value(Itr) of
{_Idx, Node} when Node == MyNode -> true;
{_Idx, _Node} -> false
end.
### Keybase proof
I hereby claim:
* I am dams on github.
* I am dams (https://keybase.io/dams) on keybase.
* I have a public key whose fingerprint is 2836 F02C F2DD C65B B030 4B52 456F 2200 3FA5 2448
To claim this, I am signing this object:

intro

  • Remote Dictionary Server
  • Salvatore Sanfilippo (antirez)
  • 2010 embauché par VMWare, puis Redis sponsorié par Pivotal 2013
  • 2015 Redis Labs

histoire

  • LiveJournal (1999) Brad Fitzpatrick
  • Memcached inventé là-bas (2003)
try {
let homeAddress: string | null = null;
let homeSearchCenter: Coordinates | null = null;
let workAddress: string | null = null;
let workSearchCenter: Coordinates | null = null;
const response = await api.get(`/users/${userId}/geolocate`);
if (!_.isNil(response.user)) {
homeAddress = capitalizeProperNoun(response.user.address);
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
LIGHT_YELLOW="\[\033[1;33m\]"
GREEN="\[\033[0;32m\]"
BLUE="\[\033[0;34m\]"
LIGHT_RED="\[\033[1;31m\]"
LIGHT_GREEN="\[\033[1;32m\]"
WHITE="\[\033[0;37m\]"
LIGHT_WHITE="\[\033[1;37m\]"
LIGHT_GRAY="\[\033[0;37m\]"
@dams
dams / test_gc.exs
Last active October 12, 2022 20:16
defmodule Test do
def question_1(), do: question_1(100_000_000)
def question_1(num), do: question_1(num, rem(num, 1119))
def question_1(num, 0), do: num
def question_1(num, _), do: question_1(num+1)
def question_2(num) do
num
|> Integer.to_string()