Skip to content

Instantly share code, notes, and snippets.

View sergiopvilar's full-sized avatar

Sergio Vilar sergiopvilar

View GitHub Profile
<?php
class CarModel extends AppModel{
public $fields = array(
'title' => true,
'editor'=> true,
'thumbnail' => true
);
}
<?php
class CarModel extends AppModel{
public $fields = array(
// Default Wordpress Fields
'title' => true,
'editor'=> true,
'thumbnail' => true,
<?php
// List all cars
foreach($app->car->find() as $car):
echo $car->title>." - ".$car->model;
foreach($car->photos as $photo):
echo "<img src='".$photo->thumbnail."' />";
endforeach;
{ "update_url":"http://clients2.google.com/service/update2/crx",
"name": "Facebook Posts Filter",
"description": "Hides posts on facebook according to specified keywords.",
"version": "0.3",
"options_page": "options.html",
"permissions": [
"storage"
],
"page_action" :
{
function hidePost(){
// Varre todas as postagens que estão na tela
$('.uiUnifiedStory, ._4ikz').each(function(i, item) {
var texto = $(item).text().toLowerCase();
// Recupera as palavras-chave cadastradas pelo usuário
chrome.storage.local.get("fbfilter_keywords", function(fetchedData) {
var keywords = fetchedData.fbfilter_keywords.split(',');
// Verifica se alguma palavra está presente no post
$(keywords).each(function(a, palavra){
palavra = palavra.toLowerCase();
<html>
<head>
<title>Facebook Filter</title>
<link rel="stylesheet" type="text/css" href="options.css" />
</head>
<body>
<div id="content">
<h1>Facebook Posts Filter</h1>
<p>Setup the keywords to hide posts on Facebook:</p>
<div id="keywords">
// Salva as opções pro localstorage
function save_options() {
var keywords = $('#keywords-field').val();
// Salva no localstorage da extensão com a chave "fbfilter_keywords"
chrome.storage.local.set({'fbfilter_keywords': keywords}, function() {
$('#status').fadeIn(800, function(){
setTimeout(function() {
$('#status').fadeOut(400);
}, 2000);
});
// Variables
var num = 100;
var str = "<span>Hello!</span><br />";
// Let's repeat the test
for(var z = 0; z < 10; z++){
document.querySelector("#main").innerHTML = '';
// Example using pure and without concat
for(var i = 0; i < num; i++){
document.querySelector("#main").innerHTML += str;
}
var main = document.querySelector("#main"),
html = main.innerHTML;
for(var i = 0; i < num; i++){
html += str;
}
main.innerHTML = html;