Skip to content

Instantly share code, notes, and snippets.

Victor Nawothnig dminuoso

Block or report user

Report or block dminuoso

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View foo.js
const toggleClass = (id, toggle) => id === toggle ? 'toggle active' : 'toggle inactive';
const Style = ({ activeFontColor, activeBackgroundColor, fontColor }) => (
<style jsx>
{`
.toggle {
width: 50%;
height: 50px;
border-radius: 100px;
line-height: 50px;
View functional.rb
module ArityRange
def arity_range
args = parameters.map(&:first)
req = args.count :req
keyreq = args.count :keyreq
opt = args.include?(:rest) ? Float::INFINITY : args.count(:opt)
keyopt = args.include?(:keyrest) ? Float::INFINITY : args.count(:key)
View fmap.rb
module Kernel
def Just(o)
Maybe.of(o)
end
end
class Maybe
def self.of(value)
new(value)
end
View gist:57297b5ddb216cfe216408a4cd946ae9
double = -> (e) { e * 2 }
doubleF = map double
doubleF.([1,2,3,4]) #=> [2,4,6,8]
doubleF.([]) #=> []
doubleF.(Just(3)) #=> Just 6
doubleF.(Nothing) #=> Nothing
View foo.rb
double = -> (e) { e * 2 }
doubleF = map double
doubleF.([1,2,3,4]) #=> [2,4,6,8]
doubleF.([]) #=> []
doubleF.(Just(3)) #=> Just 6
doubleF.(Nothing) #=> Nothing
View app.js
const render = (Component) => {
ReactDOM.render(
<Provider store={store}>
<Router history={history}>
<Component />
</Router>
</Provider>,
document.getElementById('app')
);
};
View ajax.js
$("#ajax-action2").click( function() {
const AUTH_TOKEN = $("meta[name=csrf-token]").attr("content");
request = $.ajax({
type: "PATCH",
url: "/home/no_js_view_action",
headers: {
'X_CSRF_TOKEN': AUTH_TOKEN,
},
dataType: "json",
data: {
View some.js
// Arrow function
$("#ajax-action2").click(() => {
const AUTH_TOKEN = $("meta[name=csrf-token]").attr("content");
// const
const request = $.ajax({
type: "PATCH",
url: "/home/no_js_view_action",
headers: {
'X_CSRF_TOKEN': AUTH_TOKEN,
View random.rb
takeEven = lambda.select do |x|
x if x % 2 == 0
end
View random.rb
takeEven = lambda.select do |x|
x if x % 2 == 0
end
You can’t perform that action at this time.