This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"crypto/rand" | |
"math/big" | |
) | |
var maxID = new(big.Int).SetUint64(^uint64(0)) | |
func genRandomID() uint64 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "./points" | |
p1 = RustPoint::make_point(10, 10) # => #<Fiddle::Pointer:0x007f8231e56510 ptr=0x0000010b824000 size=0 free=0x00000000000000> | |
p2 = RustPoint::make_point(20, 20) # => #<Fiddle::Pointer:0x007f8231f20970 ptr=0x0000010b824010 size=0 free=0x00000000000000> | |
RustPoint::get_distance(p1, p2) # => 14.142135623730951 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Remove old version of merb | |
sudo gem search --no-version merb | grep merb | xargs sudo gem uninstall -a | |
# Install only few gems of merb! | |
sudo gem install merb-core merb-action-args merb-assets merb-cache merb-exceptions merb-gen merb-haml merb-helpers merb-mailer merb-param-protection merb_activerecord |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is an idea how it might become Lipsiadmin Grids in the future. | |
# In particular we focused to bring them into reusable on other pages. | |
def grid | |
grid = Ext.grid "List of all accounts" do |grid| | |
#Some standard config | |
grid.append "/backend/accounts/store.js" # or :controller => :accounts, :action => :store, :format => :js | |
grid.selection :checkbox | |
grid.grouped true, "accounts.name"# true is default | |
# Render: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Aggiornamento iniziale server Fedora 10 64bit | |
rm -rf ~/upgrading | |
echo "Eseguo gli aggiornamenti e pulisco la cache" | |
yum update -y && yum clean all | |
echo "Eseguo ancora una volta gli aggiornamenti e pulisco la cache" | |
yum update -y && yum clean all | |
echo "Creo la directory di upgrade" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Configurazione iniziale server Fedora 10 64bit | |
clear | |
echo "----------------------------------------------------" | |
echo "--------------Configurazione Fedora 10--------------" | |
echo "----------------------------------------------------" | |
echo | |
echo -n "Vuoi modificare il messaggio di login? (y/n): "; read ans |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var selProductsGroupingView = new Ext.grid.GroupingView({ | |
forceFit: true | |
}); | |
var selProductsToolbar = new Ext.Toolbar(); | |
var selProductsCheckboxSelectionModel = new Ext.grid.CheckboxSelectionModel(); | |
var selProductsGroupingStore = new Ext.data.GroupingStore({ | |
reader: new Ext.data.JsonReader({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# An advanced grid | |
# | |
# products_controller.rb | |
def show | |
params[:limit] ||= 50 | |
# Our conditions | |
conditions = "products.store_id = #{current_store.id}" | |
conditions += " AND warehouses.id IN (#{current_account.warehouseship_ids.join(",")})" if current_account.magazziniere? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :admin do | |
get :show do | |
... | |
end | |
end | |
namespace :frontend do | |
get :index do | |
... | |
end |