var greeting = 'Hello';
console.log(greeting); //=> Hello
if (true) {
var greeting = 'Hi';
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.subscribers = []; | |
const defaultState = { | |
todos: [] | |
}; | |
const state = new Proxy(defaultState, { | |
set(state, key, value) { | |
const oldState = { ...state }; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sum(arr) { | |
return arr.reduce((a,b) => a + b); | |
} | |
function throttle(fn, ms) { | |
let pending = false; | |
return () => { | |
if (!pending) { | |
fn(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl ifconfig.co/json | jq | |
curl ifconfig.co/json | json_pp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const markdownEngine = markdownIt({ | |
html: true, | |
linkify: true | |
}); | |
const defaultRender = markdownEngine.renderer.rules.link_open || function(tokens, idx, options, env, self) { | |
return self.renderToken(tokens, idx, options); | |
}; | |
markdownEngine.renderer.rules.link_open = function (tokens, idx, options, env, self) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const request = require('request'); | |
const fs = require('fs'); | |
request('https://api.github.com/users/jaylandro/followers', {headers: { | |
'Accept': 'application/json', | |
'Accept-Charset': 'utf-8', | |
'User-Agent': 'my-app' | |
}}, (err, res, body) => { | |
if (err) { return console.log(err); } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import test from 'ava'; | |
test('bar', async t => { | |
const bar = Promise.resolve('food'); | |
t.is(await food, 'dinner'); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
export CATALINA_HOME=/opt/liferay-portal-6.2-ee-sp5/tomcat-7.0.42 | |
PATH=/sbin:/bin:/usr/sbin:/usr/bin | |
start() { | |
sh $CATALINA_HOME/bin/startup.sh | |
} | |
stop() { | |
sh $CATALINA_HOME/bin/shutdown.sh | |
} | |
case $1 in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<#assign locPortletId = "82" /> | |
<#assign PortletPreferencesFactoryUtil = staticUtil["com.liferay.portlet.PortletPreferencesFactoryUtil"] /> | |
<#assign portletSetup = PortletPreferencesFactoryUtil.getLayoutPortletSetup(layout, locPortletId) /> | |
<#if portletSetup.getValue("portletSetupShowBorders", "") != "false" > | |
<#assign temp = portletSetup.setValue("portletSetupShowBorders", "false") /> | |
<#assign temp = portletSetup.store() /> | |
</#if> |
NewerOlder