Skip to content

Instantly share code, notes, and snippets.

// Place your key bindings in this file to overwrite the defaults
[
{
"key": "cmd+k cmd+c",
"command": "editor.action.addCommentLine",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "cmd+k cmd+c",
"command": "-editor.action.addCommentLine",
@joeSaad
joeSaad / flattenArray.js
Created August 8, 2017 16:36
Flatten an array
function flattenMyArr(nArr) {
for (let i = 0; i < nArr.length; i++) {
if (Array.isArray(nArr[i])) {
flattenMyArr(nArr[i])
} else {
flatArr.push(nArr[i])
}
}
return flatArr;
}
@joeSaad
joeSaad / automate1.app
Last active July 30, 2017 23:08
Run shell script using an automator
on run {input, parameters}
tell application "Terminal"
if not (exists window 1) then reopen
activate
do script "test1" in window 1
delay 2
close window 1
end tell
return input
@joeSaad
joeSaad / bash
Created July 28, 2017 01:27
kill process for jboss on mac
ps -ef | grep jboss | grep -v grep | awk '{print $2}' | xargs kill -9
@joeSaad
joeSaad / Terminate port service
Created July 24, 2017 21:13
terminate server running at certain port by just typing killport <portnumber> ... create this as a shell script, chmod 700 killport and place it in your /usr/local/bin folder
lsof -i:$1 | grep LISTEN | awk '{print $2}' | xargs kill -9
echo "port $1 has been terminated"
#!/bin/bash
value=$(<$1)
echo "$value"
#!/bin/bash
# for dealing with all github repos related to npm packages, you basically clone into a directory you name
# install all related npm packages, open your favorite editor for that directory, and run your npm start or whatevever running script you had
# either npm start or npm run dev etc...
git clone $1 $2
cd $2
npm install
sublime .
@joeSaad
joeSaad / .jsx
Created November 1, 2016 18:07
Incrementer Component React
class Form extends React.Component {
constructor(props) {
super(props);
this.state = {value: 0};
this.handleChange = this.handleChange.bind(this);
this.incrementValue = this.incrementValue.bind(this);
this.decrementValue = this.decrementValue.bind(this);
}
handleChange(event) {
@joeSaad
joeSaad / gist:1a34b4849cc29493598a9effd86bc6c6
Created May 25, 2016 19:42
Typescript method call from within constructor
export class Place {
currentUser : string;
siteUri: string;
config: string;
static Place.getConfig():string {
return "myID";
};
constructor(config: string){
this.config = this.getConfig();
<style>
.tech-name span {
border:1px solid #eee;
padding: 4px;
background-color: lightgrey;
border-radius: 2px;
box-shadow: 2px 2px 2px #aaa;
}
.tech-name span:hover {