Skip to content

Instantly share code, notes, and snippets.

View chaadow's full-sized avatar
🎯
Focusing

Chedli Bourguiba chaadow

🎯
Focusing
View GitHub Profile
@HansMuller
HansMuller / system_back.dart
Last active February 14, 2022 20:49
Bottom navigation example with a Navigator per destination
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flutter code sample for NavigationBar with nested Navigator destinations.
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
class Destination {
# frozen_string_literal: true
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
gem "rails", github: "rails/rails"
@vovahost
vovahost / main.dart
Created February 27, 2019 14:20
CancelableOperation and CancelableCompleter usage example
import 'package:async/async.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
test("CancelableOperation with future", () async {
var cancellableOperation = CancelableOperation.fromFuture(
Future.value('future result'),
onCancel: () => {print('onCancel')},
);
@mrispoli24
mrispoli24 / setting-up-heroku-and-cloudflare.md
Created October 15, 2018 18:41
Setting up Heroku and Cloudflare (the right way)

Setting up Heroku and Cloudflare (the right way)

The following outlines how to setup Heroku + Cloudflare with a full SSL certificate. What this means is that communication between the browser and the Cloudflare CDN is encrypted as well as communication between Cloudflare and Heroku’s origin server. Follow these steps exactly and the setup is a breeze.

Step 1: Set up domain names in Heroku

First you want to add the root domain and the www domain to heroku. You do this by clicking into your production application, then going to settings and then scrolling down to Domains and certificates.

Here you will add <your_domain>.com and www.<your_domain>.com. This will give you two CNAME records. They will look something like <your_domain>.com.herokudns.com and www.<your_domain>.com.herokudns.com.

Step 2: Add CNAME records to Cloudfare.

@ershad
ershad / rack_attack.rb
Last active March 5, 2019 09:36
Rack::Attack sample configuration
class Rack::Attack
# By default, Rack::Attack uses `Rails.cache` to store requests information.
# It's configurable as follows -
#
# redis_client = Redis.connect(url: ENV["REDIS_URL"])
# Rack::Attack.cache.store = Rack::Attack::StoreProxy::RedisStoreProxy.new(redis_client)
class Request < ::Rack::Request
@uriannrima
uriannrima / Description.vue.js
Last active October 9, 2019 18:23
Mixin factory to create components with it's own vuex store module.
<template>
<div>
<div class="black-box rounded h-md-up">
<div>
<label>Description</label>
<minimize-button :minimize.sync="minimize"></minimize-button>
</div>
</div>
<div class="description-component" v-show="!minimize">
<div class="horizontal-container">
@wbotelhos
wbotelhos / clear-sidekiq-jobs.sh
Last active April 2, 2024 10:04
Clear Sidekiq Jobs
require 'sidekiq/api'
# 1. Clear retry set
Sidekiq::RetrySet.new.clear
# 2. Clear scheduled jobs
Sidekiq::ScheduledSet.new.clear
#!/usr/bin/env ruby
require 'JSON'
class LocationGetter
attr_reader :endpoint
def initialize(endpoint)
@endpoint = endpoint
end
@nauzilus
nauzilus / stream_vs_array.js
Last active December 25, 2023 10:52
(Highland) stream vs array transformation
(function() {
var highland = require("highland")
var array = [1,2,3],
spy = (message, fn) => {
return x => {
console.log(`${message} ${x}`)
return fn(x)
}
},
class CategoriesController < ApplicationController
include Behaveable::ResourceFinder
include Behaveable::RouteExtractor
# Response type.
respond_to :json
# Get categories.
#
# GET (/:categorizable/:categorizable_id)/categories(.:format)