Skip to content

Instantly share code, notes, and snippets.

View sukhmeet2390's full-sized avatar
🎯
Focusing

Sukhmeet Singh sukhmeet2390

🎯
Focusing
View GitHub Profile
@sukhmeet2390
sukhmeet2390 / bash
Created August 4, 2013 19:17
List of Basic Shell Commands everyone should know of
pwd
hostname
mkdir
cd
cp
mv
less
cat
xargs
find
@sukhmeet2390
sukhmeet2390 / Javascript coding styles
Created August 5, 2013 07:46
Javascript coding style
Rule 1: use var . (avoid globals)
Rule 2: Use THIS_IS_A_CONSTANT
Rule 3: Use Semicolons and the end of variable and function expressions ( and not function declarations)
Rule 4 : function declarations within blocks
//DONT if(x){
function foo()
}
function init(){
localConnection = new RTCPeerConnection(SERVER);
localConnection.onicecandidate = function(event){
event.candidate && remoteConnection.addIceCandidate(event.candidate);
};
dataChannel = localConnection.createDataChannel("sendDataChannel");
dataChannel.onerror = handleError;
//dataChannel.onmessage = function(event){console.log("message recieved" + event.data);}
dataChannel.onopen = function(){console.log("Hello world dataChannel is now open");}
@sukhmeet2390
sukhmeet2390 / .jshintrc
Created March 20, 2015 09:36
jshint file
{
// JSHint Default Configuration File (as on JSHint website)
// See http://jshint.com/docs/ for more details
"maxerr" : 50, // {int} Maximum error before stopping
// Enforcing
"bitwise" : true, // true: Prohibit bitwise operators (&, |, ^, etc.)
"camelcase" : true, // true: Identifiers must be in camelCase
"curly" : true, // true: Require {} for every new block or scope
@sukhmeet2390
sukhmeet2390 / Readme.md
Last active August 29, 2015 14:21
Working around with Yeoman , RequireJS, Mocha, Chai, Squire and Sinon

Yeoman is awesome, . RequireJS is super cool. Both don't glue together, atleast not officially.There is no official support for RequireJS from yeoman team.

Here is guide on what i did to work around with things to get it working .

Gluing them together

  • get the dependency
describe("getTweets", function () {
var fakeData = [
{
created_at: "Fri Apr 05 19:39:30 +0000 2013",
text: "tweet 1",
retweeted: false,
favorited: false,
user: { name: "name 1" }
},
/* ... */
@sukhmeet2390
sukhmeet2390 / supportedEmoji.js
Last active August 29, 2015 14:21
Currently supported Emoji set
:grinning:" : 0x1f600,
":grin:" : 0x1f601,
":joy:" : 0x1f602,
":smiley:" : 0x1f603,
":smile:": 0x1f604,
":sweat_smile:" : 0x1f605,
":laughing:": 0x1f606,
":innocent:": 0x1f607,
":smiling_imp:": 0x1f608,
":wink:": 0x1f609,
happy: [":)", ":-)", ":->"]
,sad: [":(", ":-(", ":-<"]
,grin: [":D", ":-D"]
,wink: [";)", ";-)"]
,surprise: [":O", ":-O", ":-o", ":o"]
,tongue: [":P", ":-P", ":p", ":-p"]
,shades: ["B)", "B-)"]
,angry: ["X(", "X-(", ":@", ":-@", "x(", "x-("]
,crying: [":'(", ":,("]
,indifferent: [":|", ":-|"]
http://blog.benoitvallon.com/tips/flattening-arrays-in-javascript/
http://rainsoft.io/how-three-dots-changed-javascript/
http://reactivex.io/learnrx/