Skip to content

Instantly share code, notes, and snippets.

View nvurgaft's full-sized avatar
👾
I'm a Megazord

nick nvurgaft

👾
I'm a Megazord
  • Private
  • Israel
View GitHub Profile
@nvurgaft
nvurgaft / markup.html
Created May 5, 2015 11:32
Scroll To Top angular.js directive
<!-- Angular -->
<script src="../angular.min.js"></script>
<!-- jQuery -->
<script src="../jquery-2.1.1.min.js"></script>
<!-- Font Awesome -->
<link rel="stylesheet" type="text/css" media="screen" href="css/font-awesome.min.css">
@nvurgaft
nvurgaft / crawler.java
Created August 1, 2015 09:14
simple web crawler functionality
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Main {
@nvurgaft
nvurgaft / index.html
Created August 15, 2015 09:48
Examples for using anonymouse functions with functional programming in Javascript
<div>
<p id="text1"></p>
<p id="text2"></p>
</div>
@nvurgaft
nvurgaft / es6classes.js
Created December 19, 2015 09:43
Class declartion and inheritance in Javascript ES6
// a simple class declaration in es6
class Person {
constructor(fname, lname) {
this.fname = fname;
this.lname = lname;
}
toString() {
return (this.fname + " " + this.lname);
}
@nvurgaft
nvurgaft / gist:e60fdfa3d6a9ba2d66324aa976f8238a
Created September 2, 2016 09:43
Set implementation in JavaScript
var ISet = function(array) {
this.list = array ? toSet(array) : [];
};
ISet.prototype.add = function(inValue) {
if (exists(this.list, inValue) < 0) {
this.list.push(inValue);
return true;
}
return false;
@nvurgaft
nvurgaft / gist:8086853
Last active November 19, 2016 17:44
A simple HTTP/1.0 request client. This is a free software code, use fairly!
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <netdb.h>
#include <errno.h>
@nvurgaft
nvurgaft / Worker.js
Created December 25, 2016 16:12
A simple call and back using a webworker
onmessage = function(event) {
console.debug("posting message: ", event.data);
postMessage(event.data);
}
@nvurgaft
nvurgaft / expressions.txt
Last active March 4, 2017 14:39
list of self authored regular repressions for common uses
\b[0-9a-f]{32}\b
This expression will stricly match an MD5 string
"d41d8cd98f00b204e9800998ecf8427e" will match
\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b
This expression will stricly match a canonical UUID string
@nvurgaft
nvurgaft / affix.js
Created June 9, 2017 20:25
AngularJS directive for affixing elements
angular.module('affix', []).directive('affix', [function () {
return {
restrict: 'A',
scope: {offset: "="},
link: function (scope, element, attrs) {
var offset = Number.isFinite(scope.offset) ? scope.offset : 300;
var onScroll = function () {
if (window.pageYOffset >= offset) {
element.addClass('affix'); // add affix class
} else {
@nvurgaft
nvurgaft / service.rb
Created January 30, 2018 10:41
Runs a barebone Redmine installation as a Windows service and opens it to the outside on port 3000
REDMINE_DIR = 'C:\redmine\redmine-3.4.4\redmine-3.4.4'
LOG_FILE = "#{REDMINE_DIR}\\log\\service.log"
begin
require 'win32/daemon'
include Win32
class RedmineService < Daemon
def service_init