Skip to content

Instantly share code, notes, and snippets.

View infynyxx's full-sized avatar
🫐

Prajwal Tuladhar infynyxx

🫐
View GitHub Profile
@infynyxx
infynyxx / keybase.md
Last active August 29, 2015 14:01
keybase.md

Keybase proof

I hereby claim:

  • I am infynyxx on github.
  • I am infynyxx (https://keybase.io/infynyxx) on keybase.
  • I have a public key whose fingerprint is 2412 890D 9A30 54A3 FC09 D548 46D5 20DF F3AF 4F92

To claim this, I am signing this object:

@infynyxx
infynyxx / erl_tcp.erl
Created July 8, 2014 22:35
Concurrent erlang server
-module(erl_tcp).
-export([start_server/0, connect/1, recv_loop/1]).
-define(LISTEN_PORT, 9000).
-define(TCP_OPTS, [binary, {packet, raw}, {nodelay, true}, {reuseaddr, true}, {active, once}]).
start_server() ->
case gen_tcp:listen(?LISTEN_PORT, ?TCP_OPTS) of
{ok, listen} -> spawn(?MODULE, connect, [listen]),
io:format("~p Server started.~n", [erlang:localtime()]);
@infynyxx
infynyxx / config
Created September 26, 2014 15:52
Git mirror
[core]
repositoryformatversion = 0
filemode = true
bare = true
ignorecase = true
precomposeunicode = false
[remote "origin"]
fetch = +refs/*:refs/*
mirror = true
url = https://code.google.com/p/guava-libraries/
@infynyxx
infynyxx / proc1.rs
Created September 26, 2014 16:30
proc()
let proc_variable = 25i;
let p = proc() {
proc_variable * proc_variable;
};
println!("proc value is {}", p()); //Outout: proc value is ()
@infynyxx
infynyxx / config.json
Created December 18, 2014 18:50
DW config.json
{
"logging" : {
"appenders" : [ { "type" : "console" } ],
"level" : "INFO",
"loggers" : { "io.dropwizard" : "INFO" }
},
"server" : {
"adminConnectors" : [{ "type" : "http", "port" : 9001 }],
"applicationConnectors" : [{ "type" : "http", "port" : 9000 }]
},
@infynyxx
infynyxx / checkstyle.xml
Last active August 29, 2015 14:22
checkstyle.xml
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.2//EN"
"http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
<module name="Checker">
<module name="FileTabCharacter"/>
<module name="NewlineAtEndOfFile" />
<!-- IDE-generated comment -->
<module name="RegexpSingleline">
<property name="format" value="File \| Settings \| File Templates"/>
<property name="message" value="IDE-generated comment"/>
function addGenerator(num) {
return function(toAdd) {
return num + toAdd;
}
}
var addFive = addGenerator(5);
console.log(addFive(4) == 9);
@infynyxx
infynyxx / MobileStreamRequest.php
Created July 23, 2009 18:03
Example of Template Pattern
<?php
abstract class MobileStreamsReqest {
private $_username;
private $_password;
private $_URI;
private $_version;
protected $parameters = array();
protected $requestAttrbutes = array();
protected $requestString;
@infynyxx
infynyxx / custom_event.js
Created July 23, 2009 18:11
JS custom event handling based on PrototypeJS
//Custom Event handling
Event.observe(document, 'dom:loaded', function() {
$('enableInputEvents').observe('click', function(e) {
document.fire('CheckBox:Enabled', {checked: $('enableInputEvents').checked});
});
});
document.observe('CheckBox:Enabled', function(e) {
Event.stop(e);
if (e.memo.checked) {
@infynyxx
infynyxx / anonymous.php
Created August 20, 2009 14:26
lambda in PHP
<?php
$lambda = function($time) {
echo "I am an anonymous function and being called {$times} times<br/>";
};
function nCallTo($n, Closure $function) {
for ($i = 0; $i < $n; $i++) {
$function($i+1);
}
return function() {