Skip to content

Instantly share code, notes, and snippets.

@fkautz
fkautz / x-factor-cnfs.md
Created August 24, 2018 07:17
X-Factor CNFs

The community is currently in the process of defining Cloud-Native Network Functions (CNFs). Due to the differences between the current modern architecture and cloud-native environment, many questions will arise about how to create, consume, operate, monitor and scale CNFs. As CNFs gain in popularity, it will become increasingly important to have a set of guidelines to help the community maximize the benefit received from running in the new Cloud-Native environment.

When cloud-native arrived, it was often unclear how web applications should be designed or rearchitected to make use of cloud-native infrastructure. Many mistakes were repeated due to a lack of guidance. In response, Adam Wiggins and others created a methodology known as 12 Factor Apps. 12 factor apps guide developers towards building applications capable of taking advantage of cloud-native infrastructure. These properties include but are not limited to:

  • Easier on-boarding for developers
  • Maximize portability
  • Deploy on modern cloud platfor
@staltz
staltz / introrx.md
Last active July 22, 2024 09:31
The introduction to Reactive Programming you've been missing
@ihorvorotnov
ihorvorotnov / get-social-shares
Last active May 26, 2024 08:13
Get number of shares from social platforms
Facebook*:
https://api.facebook.com/method/links.getStats?urls=%%URL%%&format=json
+ works, returns shares, likes, comments and total
Twitter:
http://urls.api.twitter.com/1/urls/count.json?url=%%URL%%&callback=twttr.receiveCount
+ v1 API but still works
Reddit:
http://buttons.reddit.com/button_info.json?url=%%URL%%

A future version of Ember will come with a new templating engine known as HTMLBars.

The original motivation for HTMLBars was to allow helpers and properties to have better contextual information about what they were bound to.

So for example, consider a template like this:

<a href="{{url}}">{{link}}</a>
nav class="nav navbar navbar-inverse" role="navigation"
div class="container"
div class="navbar-header"
button class="navbar-toggle" type="button" data-toggle="collapse" data-target=".navbar-gnav-collapse"
span class="sr-only" Toggle navigation
span class="icon-bar"
span class="icon-bar"
span class="icon-bar"
div class="collapse navbar-collapse navbar-gnav-collapse"
ul class="nav navbar-nav"
@somebody32
somebody32 / gist:5232120
Last active October 4, 2022 08:19
Список литературы для ознакомления с concurrent programming и реализацией этих принципов и подходов на ruby. Огромное спасибо @brainopia за составление.

Введение

Начать стоит отсюда. Не пугайтесь то, что это книга по незнакомой OS, эти термины практически везде одинаковые и здесь они изложены в понятной для начинающих форме.

http://www.qnx.com/developers/docs/6.4.1/neutrino/getting_started/s1_procs.html

Прочесть нужно треть главы до подраздела "Starting a process", если С не пугает, читайте полностью. После прочтения вы будете понимать, что такое process, thread, mutex, priorites, semaphores, scheduler, contex-switch, kernel states.

Ruby

@xdite
xdite / gist:3072362
Created July 8, 2012 19:10
deploy/asset.rb
# -*- encoding : utf-8 -*-
set :assets_dependencies, %w(app/assets lib/assets vendor/assets Gemfile.lock config/routes.rb)
namespace :deploy do
namespace :assets do
desc <<-DESC
Run the asset precompilation rake task. You can specify the full path \
to the rake executable by setting the rake variable. You can also \
@Fonsan
Fonsan / blocks.rb
Created May 9, 2012 18:24
First class citizen methods in ruby
def do_something
yield 'something'
end
do_something do |thing|
puts thing
end
def do_complex(first, second)
thing = 'nothing'
@nesquena
nesquena / jbuilder.rb
Created February 14, 2012 01:15
JBuilder and RABL Syntax Comparison
Jbuilder.encode do |json|
json.content format_content(@message.content)
json.(@message, :created_at, :updated_at)
json.author do |json|
json.name @message.creator.name.familiar
json.email_address @message.creator.email_address_with_name
json.url url_for(@message.creator, format: :json)
end
@andresgutgon
andresgutgon / user.rb
Created January 8, 2012 13:28
Migrate Autholugic SHA512 Passwords to BCryt Devise Passwords
# Because we have some old legacy users in the database, we need to override Devises method for checking if a password is valid.
# We first ask Devise if the password is valid, and if it throws an InvalidHash exception, we know that we're dealing with a
# legacy user, so we check the password against the SHA1 algorithm that was used to hash the password in the old database.
#SOURCES OF SOLUTION:
# http://stackoverflow.com/questions/6113375/converting-existing-password-hash-to-devise
# https://github.com/binarylogic/authlogic/blob/master/lib/authlogic/crypto_providers/sha512.rb
# https://github.com/plataformatec/devise/blob/master/lib/devise/encryptors/authlogic_sha512.rb
alias :devise_valid_password? :valid_password?
def valid_password?(password)