Skip to content

Instantly share code, notes, and snippets.

View sardaukar's full-sized avatar
:shipit:
Always be shipping

Bruno Antunes sardaukar

:shipit:
Always be shipping
View GitHub Profile
hypercard stacks
electronic whole earth catalog
manhole
Time Table of History
myst
Cosmic Osmo and the Worlds Beyond the Mackerel
Spelunx
The Computer Lab's Beyond Cyberpunk (http://www.streettech.com/bcp/BCPgraf/4zones.html)
# https://minhajuddin.com/2016/03/03/put-this-in-your-code-to-debug-anything
require 'rouge'
require 'method_source'
require 'pp'
class Dbg
def initialize(object, to:)
@object, @stream = object, to
end
@derwiki
derwiki / README.md
Last active September 27, 2023 17:50
Ruby module that you can use in a `before_action` on sensitive controllers for which you'd like a usage audit trail

Adding an audit log to your Rails app

If you have any sort of administrative interface on your web site, you can easily imagine an intruder gaining access and mucking about. How do you know the extent of the damage? Adding an audit log to your app is one quick solution. An audit log should record a few things:

  • controller entry points with parameter values
  • permanent information about the user, like user_id
  • transient information about the user, like IP and user_agent

Using the Rails framework, this is as simple as adding a before_action to your admin controllers. Here’s a basic version that I’m using in production.

@diegoconcha
diegoconcha / redux_egghead_notes.md
Last active January 18, 2022 13:23
Redux Egghead.io Notes

###Redux Egghead Video Notes###

####Introduction:#### Managing state in an application is critical, and is often done haphazardly. Redux provides a state container for JavaScript applications that will help your applications behave consistently.

Redux is an evolution of the ideas presented by Facebook's Flux, avoiding the complexity found in Flux by looking to how applications are built with the Elm language.

####1st principle of Redux:#### Everything that changes in your application including the data and ui options is contained in a single object called the state tree

class Option
private def initialize(value)
@value = value
end
def self.Some(value)
new(value)
end
None = new(nil)
@paragonie-scott
paragonie-scott / crypto-wrong-answers.md
Last active April 21, 2024 23:48
An Open Letter to Developers Everywhere (About Cryptography)
@justinwoo
justinwoo / using-rxjs-instead-of-flux-with-react.md
Last active October 21, 2023 10:16
Using RxJS instead of Flux with React to organize data flow

Reposted from Qiita

For almost a year now, I've been using this "flux" architecture to organize my React applications and to work on other people's projects, and its popularity has grown quite a lot, to the point where it shows up on job listings for React and a lot of people get confused about what it is.

Why I'm tired of using and teaching flux

There are a billion explainations on the internet, so I'll skip explaining the parts. Instead, let's cut to the chase -- the main parts I hate about flux are the Dispatcher and the Store's own updating mechanism.

If you use a setup similar to the examples in facebook/flux, and you use flux.Dispatcher, you probably have this kind of flow:

@dbrugne
dbrugne / gist:a71048fdd422fac3eef9
Created March 26, 2015 10:35
Gandi DNS zone configuration for Mailgun
# The SPF record should be present as TXT to be able to be read by Mailgun, and optionnaly as SPF.
# To do that you need to edit the zone as "expert" cause Gandi IHM refuses to create a second TXT
# record for "@" (it can occurs if you have a Google Webmaster tool verification DNS record)
email 10800 IN CNAME mailgun.org.
krs._domainkey 10800 IN TXT "k=rsa; p=MIG...QAB"
@ 10800 IN SPF "v=spf1 include:mailgun.org ~all"
@ 10800 IN TXT "v=spf1 include:mailgun.org ~all"
@ 10800 IN TXT "google-site-verification=Gy0...xrY"
@yoshikischmitz
yoshikischmitz / fizzbuzz_without_conditionals.rb
Last active August 29, 2015 14:16
A highly extensible, declarative fizzbuzz with no hardcoded if statements, and no mutation.
applicators = {3 => "fizz", 5 => "buzz"}
fizzbuzz =
(1..100).map do |n|
fb = applicators.
select{|a| n % a == 0}.
values.join
[n.to_s, fb].max # "1" > "" and "fizz" > "100000" since "1" < "a"
end
puts fizzbuzz
@addyosmani
addyosmani / package.json
Last active May 21, 2024 19:56
npm run-scripts boilerplate
{
"name": "my-app",
"version": "1.0.0",
"description": "My test app",
"main": "src/js/index.js",
"scripts": {
"jshint:dist": "jshint src/js/*.js",
"jshint": "npm run jshint:dist",
"jscs": "jscs src/*.js",
"browserify": "browserify -s Validating -o ./dist/js/build.js ./lib/index.js",