Skip to content

Instantly share code, notes, and snippets.

var alpha = /\w/;
var alphaEnd = /\w\s/;
var defaultIdentifiers = ['@', '#'];
function getCapture(text, right) {
var identifiers = arguments.length <= 2 || arguments[2] === undefined ? defaultIdentifiers : arguments[2];
var regexMap = identifiers.map(function (key) {
return [new RegExp('^' + key), new RegExp('\\s' + key)];
/* Let's get this party started */
::-webkit-scrollbar {
width: 7px;
}
/* Track */
::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
}
export function fetchActionCreator(config = {}) {
if (!config.url || !config.type) {
throw new Error('Invalid fetchActionCreator settings');
}
let beginAction = config.beginAction || `${config.type}_BEGIN`;
let successAction = config.successAction || `${config.type}_SUCCESS`;
let errorAction = config.errorAction || `${config.type}_ERROR`;
let settings = config.fetchSettings || {};
const compose = (...fns) => (x) => fns.reduce( (v, f) => v.then ? v.then(f) : f(v), x)
@justinobney
justinobney / function_composition_example.js
Last active August 26, 2015 15:35
Simple eample showing the usefulness of function composition in javascript
function stringStartsWith(search, coll, prop, transform){
return coll.filter(function(item){
var key = transform ? transform(item[prop]) : item[prop];
return key.indexOf(search) === 0
});
}
function reverse(str){
return str.split('').reverse().join('')
}
sloc --format cli-table --keys "total,source,comment" --exclude .html .\js\app
{
"growl": true,
"launch_in_dev": ["PhantomJS"],
"launch_in_ci": ["PhantomJS"],
"src_files": [
"**/*.js"
]
}
{
"parser": "babel-eslint",
"env": {
"browser": true,
"node": true,
"jasmine": true,
"phantomjs": true
},
"settings": {
"ecmascript": 6,
@justinobney
justinobney / clock.jsx
Created April 26, 2015 22:49
ReactJS learning. Clock using tock js class
// Clock Component
var timer;
var Clock = React.createClass({
componentDidMount: function() {
var self = this;
timer = new Tock({
countdown: false,
interval: 10,
callback: function() {
self.setState({
@justinobney
justinobney / Microsoft.PowerShell_profile.ps1
Created April 17, 2015 22:59
Microsoft.PowerShell_profile.ps1
Set-Alias subl 'C:\Program Files\Sublime Text 3\sublime_text.exe'
Set-Location E:\Projects
$Shell = $Host.UI.RawUI
$size = $Shell.WindowSize
$size.width=85
$size.height=150
$Shell.WindowSize = $size
$size = $Shell.BufferSize
$size.width=70