Skip to content

Instantly share code, notes, and snippets.

View kotishe's full-sized avatar
I may be slow to respond.

kotishe

I may be slow to respond.
View GitHub Profile
#include "JAbstractSocket.hpp"
JAbstractSocket::JAbstractSocket() {
this->socket = ::socket(PF_INET, SOCK_STREAM, 0);
if (this->socket == SOCKET_INVALID) this->socketError("socket()");
else {
memset(&this->address, 0, sizeof(this->address));
this->address.sin_family = AF_INET;
}
@bjarkevad
bjarkevad / classes.scala
Last active December 25, 2015 14:19
Rational number
class Rational(n: Int, d: Int) {
require(d != 0, "Denominator must be nonzero")
def this(n: Int) = this(n, 1)
private def gcd(a: Int, b: Int): Int =
if (b == 0) a else gcd(b, a % b)
private val g = gcd(n, d)
val numer = n / g
import System.Environment (getArgs)
main = do
(x:_) <- getArgs
mapM_ putStrLn $ createFizzBuzz $ read x
createFizzBuzz :: Int -> [String]
createFizzBuzz 0 = []
createFizzBuzz x = map fizzbuzz [1..x]
@xem
xem / LICENSE.txt
Last active December 25, 2015 14:19 — forked from 140bytes/LICENSE.txt
Snail matrix generator
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@raffaele-w
raffaele-w / gist:6987267
Created October 15, 2013 06:15
poly 10.13 b
public int methodsHelper(int n, int[] rec) {
if (rec[n] > 0) return rec[n];
if (rec[n] < 0) return 0;
int ret = methodsHelper(n + 1, rec) + methodsHelper(n + 2, rec);
rec[n] = (ret == 0 ? -1 : ret);
return ret;
}
public int methods(int nRock, int[] slip) {
int[] rec = new int[nRock + 1];
@tommybutler
tommybutler / .vimrc
Created October 12, 2013 20:02
My vim settings file
" don't sacrifice functionality and features just to preserve backward compatibility with vi
:set nocompatible
" turn on syntax highlighting
:syntax enable
" if a given file type (perl, ruby, python, c, etc) has its own special auto-indentation rules, use them
:filetype plugin indent on
" turn on auto-indenting (use this if you turn off option ':filetype plugin indent on')
@monokrome
monokrome / README.md
Created October 12, 2013 19:50 — forked from nikcub/README.md
@alexr
alexr / README.md
Created October 12, 2013 19:30
Dynamic computation chart sample

Simple example to show dynamically computed chart based on the data in another chart. TODO: add better computation than a slice of 10 original elements :)

@plentz
plentz / nginx.conf
Last active September 22, 2025 15:44
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@7LayersDesign
7LayersDesign / l4_gmail.php
Last active December 21, 2015 15:49
GMail config for PHP mail in Laravel 4
<?php
'driver' => 'smtp',
'host' => 'smtp.gmail.com',
'port' => 465,
'encryption' => 'ssl',
'username' => '[email protected]',
'password' => 'your-password',