Skip to content

Instantly share code, notes, and snippets.

View lmfrossard's full-sized avatar
🎯
Focusing

L. Frossard lmfrossard

🎯
Focusing
  • Rio de Janeiro - Brazil
View GitHub Profile
@BrianRosamilia
BrianRosamilia / gist:a7dd905a5dd2517f9c8e
Created September 5, 2014 02:42
Removing Facebook Posts
Array.prototype.slice.call(document.getElementsByClassName('userContentWrapper')).forEach(function(itm) {
if (itm.innerHTML.search(/nfl|football/i) != -1) {
itm.parentNode.removeChild(itm)
}
})
@enkeboll
enkeboll / facebook_post_scorer.py
Last active November 8, 2017 18:36
COMS 6998 Social Networks Facebook Post Scorer
__author__ = 'andyenkeboll'
import requests
# on mac, `sudo pip install facebook-sdk`
# https://pypi.python.org/pypi/facebook-sdk
import facebook
from collections import Counter
# `sudo pip install mechanize`
import mechanize
import re
@xlbruce
xlbruce / Recursão
Created March 27, 2015 20:33
Algoritmos recursivos simples
/**
* Máximo Divisor Comum recursivo
* @param a
* @param b
* @return O MDC de a e b
*/
public static int mdc(int a, int b) {
if (b == 0) {
return a;
}
@aniruddha-adhikary
aniruddha-adhikary / fb_image_downloader.py
Created April 5, 2015 06:41
Download all images from Facebook Profiles / Pages
#!/usr/bin/env python
import urllib2
import json
import os
from datetime import datetime
import re
params = {
@animista01
animista01 / like.js
Last active November 8, 2017 18:26
Dar Like en Facebook a todas las publicaciones que estén en pantalla
// 1. Ir a la pagina a la que se le quiere dar 'likes' a sus publicaciones
//Con el siguiente codigo se llega al final de la pagina automaticamente. Repetir hasta que sea necesario (Recomendable que haya cargado < de 50 publicaciones)
// 2. Pegar lo siguiente hasta que consideres necesario.
window.scrollTo(0, document.body.scrollHeight);
setTimeout(function(){
window.scrollTo(0, document.body.scrollHeight);
}, 2000);
@tkarabela
tkarabela / postsfilter.user.js
Last active November 8, 2017 18:28
Facebook Posts Filter
// ==UserScript==
// @name Facebook Posts Filter
// @description Regex-based filter for Facebook posts, comments and likes.
// @version 1.3
// @namespace https://github.com/tkarabela
// @include http://*.facebook.com/*
// @include https://*.facebook.com/*
// @grant GM_registerMenuCommand
// @grant GM_getValue
// @grant GM_setValue

10 Scala One Liners to Impress Your Friends

Here are 10 one-liners which show the power of scala programming, impress your friends and woo women; ok, maybe not. However, these one liners are a good set of examples using functional programming and scala syntax you may not be familiar with. I feel there is no better way to learn than to see real examples.

Updated: June 17, 2011 - I'm amazed at the popularity of this post, glad everyone enjoyed it and to see it duplicated across so many languages. I've included some of the suggestions to shorten up some of my scala examples. Some I intentionally left longer as a way for explaining / understanding what the functions were doing, not necessarily to produce the shortest possible code; so I'll include both.

1. Multiple Each Item in a List by 2

The map function takes each element in the list and applies it to the corresponding function. In this example, we take each element and multiply it by 2. This will return a list of equivalent size, compare to o

@joseluisq
joseluisq / test_node_facebook_graph_insights.js
Created February 24, 2016 23:48
Node test for Facebook Graph Insights
const FB = require('fb');
const moment = require('moment');
const options = {
appId: '',
version: 'v2.5',
appSecret: '',
scope: 'user_about_me,publish_actions,read_insights',
redirect_uri: 'http://localhost:3000/login/callback'
};
@Sephyros
Sephyros / lista_1_algoritmos.py
Created March 1, 2016 12:20
Lista de exercícios de Algoritmos
# Autor: Leonardo Vinicius Maciel
# Exercícios de Pseudocódigo convertidos para python
# O Algoritmo está escrito de forma a ficar parecido com as regras de declaração e fluxo
# de pseudocódigo, por isso, muitas convenções do python foram quebradas, além de coisas
# desnecessárias, como por exemplo a declaração de variáveis e o print antes do input (a
# string pode ser passada diretamente como parametro do input). O código também
# representa apenas uma das inúmeras possibilidades de resolução.
import math
@darthsuogles
darthsuogles / fb_graph_api_calls.py
Last active November 8, 2017 18:46
Get Facebook graph API calls
from time import sleep
from random import randint
import json
import requests
import pandas as pd
def fb_graph_api_crawl(params, **kws):
print('initial call')
res = requests.get('https://graph.facebook.com/v2.8/search', params).json()
_js_list = [res['data']]