This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > | |
<xsl:output method="xml" encoding="utf-8" indent="yes" omit-xml-declaration="yes" /> | |
<!-- usage | |
<xsl:variable name="value"> | |
<xsl:call-template name="replace"> | |
<xsl:with-param name="value" select="{root}teste/index.html" /> | |
<xsl:with-param name="from" select="'{root}'" /> | |
<xsl:with-param name="to" select="http://www.carneiro.com/" /> | |
</xsl:call-template> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ "$1" = "?" ] | |
then | |
B1="\033[1m"; | |
B2="\033[0m"; | |
echo -e ""; | |
echo -e "${B1}AUTHOR${B2}"; | |
echo -e " Marcelo Miranda Carneiro - [email protected]"; | |
echo -e ""; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getSymbolPositions(text, value){ | |
var positions = text.split(value), | |
results = []; | |
for(var i=0, len = positions.length-1; i<len; i++){ | |
results.push(positions[i].length + (results[i-1] + 1 || 0)); | |
} | |
return results; | |
} | |
getSymbolPositions("1234561891abcdefghi1lmnop", "1"); // [0, 6, 9, 19] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################## | |
## command line ## | |
################## | |
# run mysql; | |
mysql -h[host] -u[user] [database] | |
# dump database; | |
mysqldump -uroot [database] > database.sql |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ---- | |
// libsass (v3.1.0-beta) | |
// ---- | |
.test-zero { | |
$var1: 0px; | |
$var2: 0; | |
content: "values should be false"; | |
_1: ($var1 * $var2) > 0; | |
_2: ($var1 * $var2) / 1px > 0; // converting to unitless works |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
APT_INSTALL=() | |
[ "$(which git)" == "" ] && APT_INSTALL+=("git") | |
[ "$(which curl)" == "" ] && APT_INSTALL+=("curl") | |
[ "$(which vim)" == "" ] && APT_INSTALL+=("vim") | |
[ "$(which gpick)" == "" ] && APT_INSTALL+=("gpick") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<title>Test facebook feed</title> | |
<script> | |
window.getFeed = function() { | |
FB.api('/me/feed', function(response) { | |
console.log('me', response); | |
if (response.data[0]) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# cut video with 15s from 0s (super fast without conversion) | |
ffmpeg -ss 00:00:00 -t 00:00:15 -i [input] -c copy [output] | |
# fixed audio quality with 20% volume https://trac.ffmpeg.org/wiki/Encode/MP3 | |
ffmpeg -i input.mp3 -map 0:a:0 -filter:a "volume=0.2" -b:a 80k output.mp3 | |
# variable audio quality | |
ffmpeg -i input.mp3 -map 0:a:0 -qscale:a 7 output.mp3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const http = require('http') | |
const fs = require('fs') | |
const port = process.env.PORT || process.env.npm_config_port || process.env.npm_package_config_port || 3000 | |
const typeList = { | |
html: 'text/html', | |
svg: 'image/svg+xml', | |
json: 'application/json', | |
js: 'application/javascript', | |
css: 'text/css', |