Skip to content

Instantly share code, notes, and snippets.

View sembug's full-sized avatar
💭
Development

Roberto Nunes sembug

💭
Development
View GitHub Profile
@rwcasarin
rwcasarin / modal-sharepoint.html
Created January 21, 2013 12:11
Modal Sharepoint - vídeos
<script type="text/javascript" src="/_layouts/mediaplayer.js"></script>
<script type="text/javascript">
_spBodyOnLoadFunctionNames.push('mediaPlayer.createOverlayPlayer');
mediaPlayer.attachToMediaLinks( document.getElementById('campanha-video'), ['wmv', 'avi', 'mp3']);
</script>
<div id="campanha-video">
<a href="{@Midia}">Open Video</a>
</div>
@rwcasarin
rwcasarin / icon-document-library.txt
Created January 21, 2013 13:11
Pegar ícone de uma biblioteca de documentos SP2010
Muitas vezes, quando convertemos uma webpart para dataview, os ícones de tipo de documento param de funcionar ou não são exibidos de forma correta. Ou então, ao criar diretamente a exibição de dados ele também não traz a coluna do ícone funcionando perfeitamente.
Para resolver isso, basta colocar o seguinte código:
<IMG src="/_layouts/images/{ddwrt:MapToIcon(string(@HTML_x0020_File_x0020_Type),string(@DocIcon))}" />
Ele já irá dinamicamente pegar a extensão do documento e colocar o ícone correspondente.
Pode acontecer a necessidade de colocar um ícone que não é "padrão" do sharepoint. Quando ele nao acha nenhum ícone correspondente ao tipo de documento, é colocado o ícone genérico de folha em branco.
@rwcasarin
rwcasarin / force-js-sp.js
Created January 21, 2013 13:19
forçar js sharepoint rodar
if (jQuery.browser.webkit) {
jQuery(document).ready(function () {
var interval;
function loopCheck() {
if (typeof (_spBodyOnLoadWrapper) !== "undefined" && _spBodyOnLoadCalled == false)
_spBodyOnLoadWrapper();
else
window.clearInterval(interval);
}
setTimeout(function () { interval = window.setInterval(loopCheck, 30); }, 200);
@bloudermilk
bloudermilk / simple-git-flow.sh
Created March 20, 2013 23:48
A simple git workflow
#
# Starting
#
# Start a new feature branch
git checkout -b my_feature
# Make changes
# Add/Commit
@sembug
sembug / exjavascript.md
Last active April 25, 2021 11:54
Exercicios Javascript

Caesars Cipher

One of the simplest and most widely known ciphers is a Caesar cipher, also known as a shift cipher. In a shift cipher the meanings of the letters are shifted by some set amount. A common modern use is the ROT13 cipher, where the values of the letters are shifted by 13 places. Thus 'A' ↔ 'N', 'B' ↔ 'O' and so on. Write a function which takes a ROT13 encoded string as input and returns a decoded string. All letters will be uppercase. Do not transform any non-alphabetic character (i.e. spaces, punctuation), but do pass them on.

function convertToCesarCipher(str) {
    return str;
}
@aharshac
aharshac / Fetch URL title - Node.js
Last active February 25, 2021 06:47
Node.js snippet to fetch URL title
var request = require('request');
var cheerio = require('cheerio');
function fetchTitle(url, onComplete = null) {
request(url, function (error, response, body) {
var output = url; // default to URL
if (!error && response.statusCode === 200) {
var $ = cheerio.load(body);
console.log(`URL = ${url}`);