Skip to content

Instantly share code, notes, and snippets.

View techsin's full-sized avatar
🏠
Working from home

techsin techsin

🏠
Working from home
  • New York, NY
View GitHub Profile
@techsin
techsin / reward.css
Last active May 18, 2016 20:27
reward-widget
#reward-list > div.container .rewards .reward {
display: inline-block;
margin:0;
width: calc(33% - 10px);
padding: 15px;
}
@techsin
techsin / activity.css
Last active May 18, 2016 20:27
activity widget
#activity-list > div.header.ct-header-color {
background-color: transparent!important;
border-bottom-color: #DE1F26;
padding:0;
}
#activity-list > div.header.ct-header-color h3 {
background-color: #DE1F26;
width: 200px;
padding: 0;
@techsin
techsin / survey.css
Created May 19, 2016 15:40
Survey Widget
#survey > div.header.ct-header-color {
position: relative;
width: 500px;
margin: auto;
display: block;
background-color: #DE1F26!important;
overflow:autop;
border: none;
}
@import url(https://fonts.googleapis.com/css?family=Open+Sans:400,700,300);
* {
/*font-family: 'Oswald', sans-serif;*/
font-family: 'Open Sans', sans-serif;
color: white!important;
}
html {
overflow: hidden;
<!DOCTYPE html>
<html class="no-js" lang="en"><!-- <![endif]--><head><style type="text/css">@charset "UTF-8";[ng\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak,.ng-hide{display:none !important;}ng\:form{display:block;}.ng-animate-block-transitions{transition:0s all!important;-webkit-transition:0s all!important;}.ng-hide-add-active,.ng-hide-remove{display:block!important;}</style>
<meta charset="utf-8">
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
<base href="/">
<title>Working with us: The Small Group: The Big Organization</title>
<meta content="width=device-width, initial-scale=1.0, user-scalable=no" name="viewport">
<link href="http://local-resources.crowdtwist.com/v84/widgets/stylesheets/ct-widgets.css" rel="stylesheet">
<script>
.widget .header h3 {
padding:30px!important;
color: green!important;
background-color: black!important;
font-size:30px!important;
text-align: center!important;
}
var max = 20;
var i = 0;
var word;
while (i++ < max) {
if (i % 3 == 0) {
word = 'Fizz';
if (i % 5 == 0) {
word += 'Buzz';
}
} else if (i % 5 == 0) {
/*
Question 1 -- sumOfTwo(a,b,v): You have two integer arrays, a and b, and an integer target value v. Determine whether there is a pair of numbers, where one number is taken from a and the other from b, that can be added together to get a sum of v. Return true if such a pair exists, otherwise return false.
Question 2 -- stringReformatting(string): The string s contains dashes that split it into groups of characters. You are given an integer k that represents the number of characters in groups that your output should have. Your goal is to return a new string that breaks s into groups with a length of k by placing dashes at the correct intervals. If necessary, the first group of characters can be shorter than k. It is guaranteed that there are no consecutive dashes in s.
For s = "2-4a0r7-4k" and k = 4, the output should be stringReformatting(s, k) = "24a0-r74k";
The input string "2-4a0r7-4k" is split into three groups with lengths of 1, 5 and 2. Since k = 4, you need to split the string into two groups of
socket.emit('message', "this is a test"); //sending to sender-client only
socket.broadcast.emit('message', "this is a test"); //sending to all clients except sender
socket.broadcast.to('game').emit('message', 'nice game'); //sending to all clients in 'game' room(channel) except sender
socket.to('game').emit('message', 'enjoy the game'); //sending to sender client, only if they are in 'game' room(channel)
socket.broadcast.to(socketid).emit('message', 'for your eyes only'); //sending to individual socketid
io.emit('message', "this is a test"); //sending to all clients, include sender
io.in('game').emit('message', 'cool game'); //sending to all clients in 'game' room(channel), include sender
io.of('myNamespace').emit('message', 'gg'); //sending to all clients in namespace 'myNamespace', include sender
socket.emit(); //send to all connected clients
socket.broadcast.emit(); //send to all connected clients except the one that sent the message
@techsin
techsin / findIfSumExists.js
Last active October 20, 2017 19:44
Find if there exists two number in array that have sum equal to target.
function isThere(arr, t) {
//Usually Mergesort n log(n)
arr.sort((a,b)=> a>b?true:false);
let i = 0,
j = arr.length-1,
x = arr[i],
y = arr[j];
// O(n)