Skip to content

Instantly share code, notes, and snippets.

View guilleiguaran's full-sized avatar
💭

Guillermo Iguaran guilleiguaran

💭
View GitHub Profile
@poteto
poteto / FBGroupMemberRemover.js
Last active September 11, 2019 17:49
Delete everyone from your Facebook group! Thanks for the dark UX, FB
class FBGroupMemberRemover {
constructor() {
this.adminText = 'Admin';
this.removeMemberModalHeadingText = 'Remove Member';
this.memberElementSelector = '[data-name="GroupProfileGridItem"]';
this.memberContextMenuSelector = 'button[aria-label="Member Settings"]';
this.removeMemberButtonSelector = 'a[data-testid="leave_group"]'
this.removalOptions = {
@rtyler
rtyler / gist:7d9fd30a7093c7cd362b
Created July 25, 2015 19:16
Fun with Nashorn and JRuby
➜ ~ pry
[1] pry(main)> require 'java'
=> false
[2] pry(main)> puts RUBY_PLATFORM; puts RUBY_VERSION
java
1.9.3
=> nil
[3] pry(main)> java_import 'javax.script.ScriptEngineManager'
=> [Java::JavaxScript::ScriptEngineManager]
[4] pry(main)> engine = ScriptEngineManager.new.get_engine_by_name('nashorn')
@jeregrine
jeregrine / Howto.md
Created May 12, 2015 19:37
Setting up Redo and Poolboy for redis connections in Elixir

Then add

worker(Redis, []),

to your supervision tree

source :rubygems
# We are not loading Active Record, nor Active Resources etc.
# We can do this in any app by simply replacing the rails gem
# by the parts we want to use.
gem "actionpack", "~> 3.2"
gem "railties", "~> 3.2"
gem "tzinfo"
# Let's use thin
@dgraham
dgraham / fetch.js
Last active March 24, 2023 15:44
Simple window.fetch wrapper.
(function() {
function status(response) {
if (response.ok) {
return response
} else {
var error = new Error(response.statusText || response.status)
error.response = response
throw error
}
}
@Liryna
Liryna / ARMDebianUbuntu.md
Last active May 20, 2024 15:04
Emulating ARM on Debian/Ubuntu

You might want to read this to get an introduction to armel vs armhf.

If the below is too much, you can try Ubuntu-ARMv7-Qemu but note it contains non-free blobs.

Running ARM programs under linux (without starting QEMU VM!)

First, cross-compile user programs with GCC-ARM toolchain. Then install qemu-arm-static so that you can run ARM executables directly on linux

@meh
meh / lol.exs
Created December 16, 2013 17:29
defmodule Fun do
def arity(fun) do
case :erlang.fun_info(fun, :arity) do
{ :arity, arity } ->
arity
end
end
def adapt!(fun, 0) do
fn -> fun.([]) end
@courtneyfaulkner
courtneyfaulkner / devices.c
Created December 11, 2013 22:20
List OpenCL platforms and devices
#include <stdio.h>
#include <stdlib.h>
#ifdef __APPLE__
#include <OpenCL/opencl.h>
#else
#include <CL/cl.h>
#endif
int main() {
(ns paddleguru.algebra
"Shared algebras for cljs and clj.")
(defprotocol Semigroup
(plus [l r]))
;; Shared extensions
(extend-protocol Semigroup
nil
(plus [l r] r))
@guilleiguaran
guilleiguaran / maybe.rb
Last active December 20, 2015 22:48
Maybe monad
# Consider the option type Maybe(a), representing a value that is either a single value of type a, or no value at all.
# To distinguish these, we have two algebraic data type constructors: Just(x), containing the value x, or Nothing,
# containing no value.
#
# data Maybe(t) = Just(t) | Nothing
#
# We would like to be able to use this type as a simple sort of checked exception: at any point in a computation,
# the computation may fail, which causes the rest of the computation to be skipped and the final result to be Nothing.
# If all steps of the calculation succeed, the final result is Just(x) for some value x.