View main.cpp
This file contains 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
#include <Windows.h> | |
#include <WinUser.h> | |
#include <iostream> | |
using namespace std; | |
int main(){ | |
//0..65535,0..65535 | |
int x =30000, y = 3000; | |
mouse_event(MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE, x, y, 0, 0); | |
mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0); |
View sample.hs
This file contains 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
-- such functionality already exist in Control.Lens in '&' operator | |
-- '|>' alreade used in Data.Sequence | |
module Main where | |
(|>) :: a -> (a -> b) -> b | |
(|>) a fun = fun a | |
infixl 1 |> | |
main = print $ [1..10] |> map (*2) |> filter (>5) |> foldr1 (+) | |
-- have idea to improve that function: print $ [1..10] |> map (*2) |> filter (>5) |> foldr1 (+) |
View baker.cpp
This file contains 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
/* | |
* BakerMemoryManager.cpp | |
* | |
* Implementation of BakerMemoryManager class | |
* | |
* LLST (LLVM Smalltalk or Low Level Smalltalk) version 0.2 | |
* | |
* LLST is | |
* Copyright (C) 2012-2013 by Dmitry Kashitsyn <korvin@deeptown.org> | |
* Copyright (C) 2012-2013 by Roman Proskuryakov <humbug@deeptown.org> |
View infix-to-prefix.rkt
This file contains 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
#lang racket | |
(define operators (hash '+ 5 '- 5 '* 10 '/ 10)) | |
(define (priority operator) | |
(hash-ref operators operator 0)) | |
(define (operator? operator) | |
(hash-has-key? operators operator)) |
View milan.hs
This file contains 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 Main where | |
import Text.ParserCombinators.Parsec | |
import Control.Applicative ((<*>), (*>), (<*), (<$>), pure) | |
import Data.Functor | |
import Data.List | |
data CompilerState = CompilerState { commands :: [VMCommand], | |
errors :: [String], | |
variables :: [(String, Int)] } --Map | |
deriving (Eq, Show) |
View typehinting.js
This file contains 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
// from https://news.ycombinator.com/item?id=8024116 | |
function checkType(f) { | |
return function(a) { | |
var type = f.toString().match(/\/\/(.*)\n/)[1].trim(); | |
if(type !== typeof(a)) throw new Error('Invalid type'); | |
return f(a); | |
} | |
} | |
View gist:a83f5a4ca4d222d5fe88
This file contains 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
// http://ideone.com/ZmrJtE | |
#include <iostream> | |
#include <functional> | |
using namespace std; | |
using namespace std::placeholders; | |
template <typename A, typename B, typename C> | |
function<C(B)> operator^(A a, function<C(A,B)> fun){ |
View DriveConsole.java
This file contains 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 com.company; | |
import javax.net.ssl.HttpsURLConnection; | |
import java.io.*; | |
import java.net.InetAddress; | |
import java.net.ServerSocket; | |
import java.net.Socket; | |
import java.net.URL; | |
import java.text.SimpleDateFormat; | |
import java.util.Calendar; |
View channels.hs
This file contains 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 Main (main) where | |
import Control.Concurrent (forkIO, threadDelay) | |
import Control.Concurrent.Chan (Chan, newChan, writeChan, readChan) | |
import Control.Monad (forM_, replicateM) | |
baseDelay = 2000 | |
writerDelay = 1 * baseDelay | |
readerDelay = 2 * baseDelay | |
View zipWithIterNum.hs
This file contains 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
zipWithIterNum :: (Integer -> a -> b -> c) -> [a] -> [b] -> [c] | |
zipWithIterNum fun l r = zipWithIterNum' 0 l r | |
where n = length l | |
zipWithIterNum' _ [] _ = [] | |
zipWithIterNum' _ _ [] = [] | |
zipWithIterNum' i (x:xs) (y:ys) = (fun i x y):(zipWithIterNum' (i + 1) xs ys ) |
OlderNewer