An introduction to curl
using GitHub's API.
Makes a basic GET request to the specifed URI
curl https://api.github.com/users/caspyin
function slugify(text) | |
{ | |
return text.toString().toLowerCase() | |
.replace(/\s+/g, '-') // Replace spaces with - | |
.replace(/[^\w\-]+/g, '') // Remove all non-word chars | |
.replace(/\-\-+/g, '-') // Replace multiple - with single - | |
.replace(/^-+/, '') // Trim - from start of text | |
.replace(/-+$/, ''); // Trim - from end of text | |
} |
An introduction to curl
using GitHub's API.
Makes a basic GET request to the specifed URI
curl https://api.github.com/users/caspyin
function string_to_slug (str) { | |
str = str.replace(/^\s+|\s+$/g, ''); // trim | |
str = str.toLowerCase(); | |
// remove accents, swap ñ for n, etc | |
var from = "àáäâèéëêìíïîòóöôùúüûñç·/_,:;"; | |
var to = "aaaaeeeeiiiioooouuuunc------"; | |
for (var i=0, l=from.length ; i<l ; i++) { | |
str = str.replace(new RegExp(from.charAt(i), 'g'), to.charAt(i)); | |
} |
When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:
const Article = require('../../../../app/models/article');
Those suck for maintenance and they're ugly.
PRs are a great way of sharing information, and can help us be aware of the changes that are occuring in our codebase. They are also an excellent way of getting peer review on the work that we do, without the cost of working in direct pairs.
Ultimately though, the primary reason we use PRs is to encourage quality in the commits that are made to our code repositories
Done well, the commits (and their attached messages) contained within tell a story to people examining the code at a later date. If we are not careful to ensure the quality of these commits, we silently lose this ability.
var myScript = document.createElement('script'); | |
myScript.src = 'http://code.jquery.com/jquery-2.1.4.min.js'; | |
myScript.onload = function() { | |
console.log('jQuery loaded.'); | |
}; | |
document.body.appendChild(myScript); |
import { createFilter } from 'rollup-pluginutils' | |
function assign (target, source) { | |
Object.keys(source).forEach((key) => { | |
target[key] = source[key] | |
}) | |
return target | |
} | |
const DEFAULT_HEADER = 'import React from \'react\';' |
javascript:(function(w){ | |
var arr = ['contextmenu','copy','cut','paste','mousedown','mouseup','beforeunload','beforeprint']; | |
for(var i = 0, x; x = arr[i]; i++){ | |
if(w['on' + x])w['on' + x] = null; | |
w.addEventListener(x, function(e){e.stopPropagation()}, true); | |
}; | |
for(var j = 0, f; f = w.frames[j]; j++){try{arguments.callee(f)}catch(e){}}})(window); |
node_modules |
First set out your build scripts In your package.json scripts and install the gh-pages npm module
"build": "gatsby build",
"test": "echo \"no test specified\" && exit 0",
"preDeploy": "gatsby build --prefix-paths",
"deploy": "npm run preDeploy && gh-pages -d public"
Connect Travis CI to your repo and in the repo settings add an enviroment var call GITHUB_TOKEN with the value of your github token from: