Skip to content

Instantly share code, notes, and snippets.

View reza-ryte-club's full-sized avatar

Reza reza-ryte-club

View GitHub Profile
// server.js
var socketIO = require(‘socket.io’);
var socketIOHelper = require(‘./app/helpers/socketio’);
var PORT = process.env.PORT || 8088;
var server = app.listen(config.port, function() {
console.log(‘Listening on port ‘ + config.port);
});
var io = socketIO(server);
socketIOHelper.set(io);
{
"_id" : ObjectId("56cfcac32239305dc57ed859"),
"profile_url" : "https://s3-ap-southeast-1.amazonaws.com/amaderdoctor/misc/person.png",
"is_admin" : 1,
"is_active" : true,
"is_manager" : 0,
"is_mpo" : 0,
"is_fieldstaff" : 0,
"is_rmp" : 0,
"is_doctor" : 0,

Modern, Usable, Responsive Sliders.

Based on Ana Tudor's styling of Range Sliders, I have used my own extension for jQueryUI to create really usable and pretty range sliders.

A Pen by Simon Goellner on CodePen.

License.

// C++ includes used for precompiling -*- C++ -*-
// Copyright (C) 2003-2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
@reza-ryte-club
reza-ryte-club / Stack.java
Last active August 29, 2015 14:27
(Collected from Princeton CS website) A Stack implementation with Java and Linked List //The jar file can be downloaded from http://algs4.cs.princeton.edu/code/algs4.jar
/******************************************************************************
* Compilation: javac Stack.java
* Execution: java Stack < input.txt
* Dependencies: StdIn.java StdOut.java
*
* A generic stack, implemented using a singly-linked list.
* Each stack element is of type Item.
*
* This version uses a static nested class Node (to save 8 bytes per
* Node), whereas the version in the textbook uses a non-static nested
@reza-ryte-club
reza-ryte-club / Compress.java
Created August 22, 2015 09:34
Compress consecutive character occurrence of a character in a String
public class Compress {
public static String compressedString(String str){
StringBuilder dest = new StringBuilder();
for(int i=0;i<str.length();i++){
char c = str.charAt(i);
dest.append(c);
int j = i;
@reza-ryte-club
reza-ryte-club / ReplaceCharacter.java
Created August 22, 2015 07:50
Replace a character with a string
public class ReplaceCharacter {
public static String stringReplacer(String str,char source,String replaced){
StringBuilder dest = new StringBuilder();
for(int i = 0;i<str.length();i++){
char ch = str.charAt(i);
if(ch==source){
dest.append(replaced);
@reza-ryte-club
reza-ryte-club / IsPermutation.java
Created August 22, 2015 07:41
Check whether a string is a permutation of another string
import java.util.Arrays;
public class IsPermutation {
public static boolean isPermutation(String str1, String str2){
if(str1.length() != str2.length()) return false;
char[] c1 = str1.toCharArray();
char[] c2 = str2.toCharArray();
Arrays.sort(c1);
Arrays.sort(c2);
@reza-ryte-club
reza-ryte-club / StringReverse.java
Created August 22, 2015 07:23
Reverse A String
public class StringReverse {
public static String reverseString(String str){
StringBuilder dest = new StringBuilder(str.length());
for(int i = str.length()-1;i>=0;i--){
dest.append(str.charAt(i));
}
return dest.toString();
}
@reza-ryte-club
reza-ryte-club / Unique.java
Last active August 29, 2015 14:27
Check whether a string has uniqe characters
package com.company;
public class Unique {
public static boolean checkUnique(String word){
if(word.length()>256) return false;// if a string is more than 256 characters long, it repeats any of the string
boolean[] charset = new boolean[256];
for(int i = 0;i<word.length();i++){
char c = word.charAt(i);
if(charset[c]) return false;
charset[c]=true;