Skip to content

Instantly share code, notes, and snippets.

Two Different Repositories (USB or Different Path)

  1. Create (option --no-hardlinks)

    mkdir /path/to/repository.git git clone --local --bare [--no-hardlinks] . /path/to/repository.git

  2. Initial Data From branchname(could be master)

@sposmen
sposmen / browser_helper.js
Last active August 29, 2015 13:59 — forked from todoubled/spec_helper.coffee
Emulate browser inside nodejs
var window;
if (typeof window === "undefined" || window === null) {
window = {};
}
if (typeof jQuery === "undefined" || jQuery === null) {
global.$ = require('jquery');
}
java 1.7.0_55
hadoop 2.4.0
hive 0.11
postgres 9.3
@sposmen
sposmen / completeToLength.js
Last active August 29, 2015 14:01
Complete a string (number) to the specified length. Useful when you needs a formatted number as '00000123'
/**
* Generates a string length of a specific character
* @param char Character to repeat
* @param times How many times
* @returns {string}
*/
String.prototype.repeat= function(n){
n= n || 1;
return Array(n+1).join(this);
}
// Connect to origin db
use some_database; // This will be named db
// Connecto to destiny db2
db2 = db.getSiblingDB('some_other_db');
// Only if needed clean destiny collection
db2.some_or_other_collection.remove({});
// Search all origin collection and copy each to destiny collection
'use strict';
var urlLib = require('url');
function UrlAdapter(urlString) {
this.urlObj = urlLib.parse(urlString, true);
// XXX remove the search property to force format() to use the query object when transforming the url object to a string
delete this.urlObj.search;
}
UrlAdapter.prototype.parse = urlLib.parse;
@sposmen
sposmen / crawler.py
Last active August 29, 2015 14:05 — forked from Azazeo/crawler.py
MAX_THREADS = 5
delay = 0.5
import psycopg2
import re
import sys
import time
import threading
import urllib2
import urlparse
@sposmen
sposmen / iframe_index.html
Last active August 29, 2015 14:07
Iframe redirect after load
<html>
<body>
Testing
<br>
<iframe id="deeptarget" name="deeptarget" src="about:blank" width="100%">
</iframe>
<script type="application/javascript" src="iframe_script.js"></script>
</body>
</html>
var net = require('net');
var clients = [];
net.createServer(function (socket) {
clients.push(socket);
socket.on('data', function (data) {
broadcast(data, socket);
});
@sposmen
sposmen / Query.sql
Created May 29, 2012 20:47 — forked from elhoyos/Query.sql
Sort by two factors
-- Todos los artículos de 'RAFA' primero ordenados por serial y luego el resto de artículos ordenados igualmente por serial.
SELECT a.* FROM articulos a LEFT JOIN (SELECT 'RAFA' COLLATE utf8mb4_general_ci AS nombre) r on r.nombre = a.usuario
ORDER BY r.nombre DESC, serial