REGEX remove blank lines:
FROM: http://www.ultraedit.com/support/tutorials_power_tips/ultraedit/remove_blank_lines.html
FIND:
^(?:[\t ]*(?:\r?\n|\r))+
pub fn header(otext, divider string) string { | |
cols, _ := get_terminal_size() | |
mut text := otext | |
if text.len > 0 { | |
text = ' $text ' | |
} | |
// clip the text if it is too long | |
text = if cols > text.len + 1 + 2*divider.len { text } else { text[0..cols-(1+2*divider.len)] } | |
// make the text align with the terminal size: | |
if (text.len % 2) != (cols % 2 ) { |
// Copyright 2015 the V8 project authors. All rights reserved. | |
// Use of this source code is governed by a BSD-style license that can be | |
// found in the LICENSE file. | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <fstream> | |
#include <iostream> |
// Since ES6 Map()'s' retain their order of insertion, it can sometimes be useful to get the last item or value inserted: | |
export const getLastItemInMap = map => Array.from(map)[map.size-1] | |
export const getLastKeyInMap = map => Array.from(map)[map.size-1][0] | |
export const getLastValueInMap = map => Array.from(map)[map.size-1][1] | |
// Obviously getLastKey and getLastValue can reuse getLastItem, but for maximum portability I opted for verbosity. |
var getTimeLeft = function(){ | |
var now = moment(); | |
var deadline = now.clone().hour(12).minute(0),second(0); | |
if(now.isAfter(deadline) { | |
// disable RSVP button here | |
return ‘Closed’; | |
}else { | |
// enable RSVP button here | |
// returns “in x hours”, “in x minutes”, “in a few seconds” | |
return deadline.from(now); |
REGEX remove blank lines:
FROM: http://www.ultraedit.com/support/tutorials_power_tips/ultraedit/remove_blank_lines.html
FIND:
^(?:[\t ]*(?:\r?\n|\r))+
-- Remove the history from | |
rm -rf .git | |
-- recreate the repos from the current content only | |
git init | |
git add . | |
git commit -m "Initial commit" | |
-- push to the github remote repos ensuring you overwrite history | |
git remote add origin git@github.com:<YOUR ACCOUNT>/<YOUR REPOS>.git |
#include <gtk/gtk.h> | |
enum | |
{ | |
COLUMN_ARTICLE = 0, | |
COLUMN_PRICE, | |
N_COLUMNS | |
}; | |
typedef struct |
var data = "do shash'owania"; | |
var crypto = require('crypto'); | |
crypto.createHash('md5').update(data).digest("hex"); |
#!/bin/bash | |
unset GIT_DIR | |
cd /path/to/project | |
# Get our info.... | |
LATEST_TAG=$(git describe --tags --abbrev=0) | |
CURRENT_REVISION=$(git describe) | |
NUMBER_FILES_CHANGED=$(git diff --name-only HEAD $LATEST_TAG | wc -l) | |
#FILES_CHANGED=$(git diff --name-only HEAD $LATEST_TAG) |