Skip to content

Instantly share code, notes, and snippets.

View jonataswalker's full-sized avatar
💭
I may be slow to respond.

Jonatas Walker jonataswalker

💭
I may be slow to respond.
View GitHub Profile
@coolaj86
coolaj86 / how-to-publish-to-npm.md
Last active April 2, 2024 20:18
How to publish packages to NPM

Getting Started with NPM (as a developer)

As easy as 1, 2, 3!

Updated:

  • Aug, 08, 2022 update config docs for npm 8+
  • Jul 27, 2021 add private scopes
  • Jul 22, 2021 add dist tags
  • Jun 20, 2021 update for --access=public
  • Sep 07, 2020 update docs for npm version
@bpierre
bpierre / Makefile
Created November 5, 2011 17:34
A Makefile to concatenate / minify my JS Scripts and convert/compress my Stylus (CSS preprocessor) files
# JS files
JS_FINAL = js/project-name-all.js
JS_TARGETS = js/file1.js \
js/file2.js \
js/file3.js
# CSS files
CSS_FINAL = css/project-name-all.css
STYLUS_TARGETS = css/file1.styl \
@tmcgilchrist
tmcgilchrist / git-rebase.markdown
Created February 10, 2012 02:58
Git rebase workflow

Checkout a new working branch

 git checkout -b <branchname>

Make Changes

 git add
 git commit -m "description of changes"

Sync with remote

@n1k0
n1k0 / output.log
Created February 14, 2012 23:55
Casper script
$ casperjs event.js
[info] [phantom] Starting...
[info] [phantom] Running suite: 3 steps
[debug] [phantom] Successfully injected Casper client-side utilities
[info] [phantom] Step 2/3 file:///Users/niko/Sites/casperjs/test.html (HTTP 0)
[debug] [phantom] start page is loaded
[info] [phantom] Step 2/3: done in 207ms.
[info] [phantom] Step 3/3 file:///Users/niko/Sites/casperjs/test.html (HTTP 0)
[info] [phantom] Step 3/3: done in 310ms.
[info] [phantom] Done 3 steps in 406ms
@paullewis
paullewis / gist:1981455
Created March 5, 2012 22:03
Quicksort in JavaScript
/**
* An implementation for Quicksort. Doesn't
* perform as well as the native Array.sort
* and also runs the risk of a stack overflow
*
* Tests with:
*
* var array = [];
* for(var i = 0; i < 20; i++) {
* array.push(Math.round(Math.random() * 100));
@tanabe
tanabe / gist:2918306
Created June 12, 2012 15:45
phantom.js webserver
(function() {
var server = require('webserver').create();
var service = server.listen(9876, function (request, response) {
var fs = require('fs');
var file = fs.read(fs.workingDirectory + request.url);
response.statusCode = 200;
response.headers['Content-Type'] = 'text/html';
response.write(file);
response.close();
});
@matthewlehner
matthewlehner / autopgsqlbackup
Created July 11, 2012 16:10
Auto PostgreSQL backup script.
#!/bin/bash
#
# PostgreSQL Backup Script Ver 1.0
# http://autopgsqlbackup.frozenpc.net
# Copyright (c) 2005 Aaron Axelsen <axelseaa@amadmax.com>
#
# This script is based of the AutoMySQLBackup Script Ver 2.2
# It can be found at http://sourceforge.net/projects/automysqlbackup/
#
# The PostgreSQL changes are based on a patch agaisnt AutoMySQLBackup 1.9
@axelpale
axelpale / combinations.js
Last active July 7, 2023 10:37
JavaScript functions to calculate combinations of elements in Array.
/**
* Copyright 2012 Akseli Palén.
* Created 2012-07-15.
* Licensed under the MIT license.
*
* <license>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files
* (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,
@alexmcpherson
alexmcpherson / scrape.js
Created September 17, 2012 00:52
Casper.js vimrc scraper
var casper = require("casper").create();
var url = "https://github.com/search?langOverride=VimL&language=&q=vimrc&repo=&type=Repositories&start_value=" + casper.cli.get(0);
var repoLinks = [];
var fileLinks = [];
function getRepoLinks() {
var links = [];
$("div.results .result h2 a").each(function(i,el){
links.push(el.href);
});
@n1k0
n1k0 / Howto.md
Created October 1, 2012 17:59
CasperJS test cli hooks example

Put test1.js and test2.js into a tests/ directory, then run the suite:

$ casperjs test tests/ --pre=pre.js --includes=inc.js --post=post.js
Test file: /Users/nperriault/tmp/pre-inc/pre.js                                 
Hey, I'm executed before the suite.
Test file: /Users/nperriault/tmp/pre-inc/tests/test1.js                         
# this is test 1
Hi, I've been included.
PASS Subject is strictly true